AcWing 670. 動物

nighty_k 2022-01-07 20:07:44 阅读数:627

acwing

鏈接
https://www.acwing.com/problem/content/672/

思路
層級判斷

#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
int main()
{

string name1, name2, name3;
cin >> name1 >> name2 >> name3;
if(name1 == "vertebrado")
{

if(name2 == "ave")
{

if(name3 == "carnivoro") printf("aguia\n");
else printf("pomba\n");
}
else
{

if(name3 == "onivoro") printf("homem\n");
else printf("vaca\n");
}
}
else
{

if(name2 == "inseto")
{

if(name3 == "hematofago") printf("pulga\n");
else printf("lagarta\n");
}
else
{

if(name3 == "hematofago") printf("sanguessuga\n");
else printf("minhoca\n");
}
}
return 0;
}
版权声明:本文为[nighty_k]所创,转载请带上原文链接,感谢。 https://gsmany.com/2022/01/202201072007443260.html