题目描述
dongwu就是判断麻烦
样例
#include <iostream>
using namespace std;
int main()
{
string a, b, c;
cin >> a >> b >> c;
if (a == "vertebrado")//一层一层的判断
{
if (b == "ave")
{
if (c == "carnivoro") cout << "aguia" << endl;
else if(c == "onivoro") cout << "pomba" << endl;
}
if (b == "mamifero")
{
if (c == "onivoro") cout << "homem" << endl;
else if (c == "herbivoro") cout << "vaca" <<endl;
}
}
if (a == "invertebrado")
{
if (b == "inseto")
{
if (c == "hematofago") cout << "pulga" << endl;
else if (c == "herbivoro") cout <<"lagarta" << endl;
}
if (b == "anelideo")
{
if (c == "hematofago") cout << "sanguessuga" << endl;
else if (c == "onivoro") cout << "minhoca" << endl;
}
}
return 0;
}
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla