题目描述
用首字母表示
样例
#include <iostream>
#include <string>
using namespace std;
int main() {
string a[3];
string ss;
for (int i = 0; i < 3; i++) {
cin >> a[i];
ss += a[i][0];
}
if (ss == "vac") {
cout << "aguia" << endl;
}
else if (ss == "vao") {
cout << "pomba" << endl;
}
else if (ss == "vmo") {
cout << "homem" << endl;
}
else if (ss == "vmh") {
cout << "vaca" << endl;
}
else if (ss == "iih") {
if (a[2] == "hematofago") {
cout << "pulga";
}
else cout << "lagarta";
}
else if (ss == "iah") {
cout << "sanguessuga";
}
else if (ss == "iao") {
cout << "minhoca";
}
return 0;
}
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla