【思路】:採用atoi转换长度。两边仅仅和大于第三边,两边之差小于第三边。
【AC代码】:
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring> using namespace std; #define MAX 100+10 int main() { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); int i = 0, tri[3]; for (i = 0; i < 3; i++) { int j = 0, n = 0, len; char temp[10], length[5+1]; cin >> n; while (n--) { cin >> temp; if (!strcmp(temp, "one")) length[j++] = '1'; else if (!strcmp(temp, "two")) length[j++] = '2'; else if (!strcmp(temp, "three")) length[j++] = '3'; else if (!strcmp(temp, "four")) length[j++] = '4'; else if (!strcmp(temp, "five")) length[j++] = '5'; else if (!strcmp(temp, "six")) length[j++] = '6'; else if (!strcmp(temp, "seven")) length[j++] = '7'; else if (!strcmp(temp, "eight")) length[j++] = '8'; else if (!strcmp(temp, "nine")) length[j++] = '9'; else if (!strcmp(temp, "zero")) length[j++] = '0'; } length[j] = '