"Thinking": Using atoi conversion length, both sides and greater than the third side, the difference between the two sides less than the third side.
"AC Code":
#include <iostream> #include <algorithm> #include <cstdio> #include <cstring>using namespace STD; #define MAX 100+10int 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, "" ")) 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 '; El Se if (!strcmp (temp, "nine")) length[j++] = ' 9 ', else if (!strcmp (temp, "zero")) length[j++] = ' 0 ';} LENGTH[J] = ' + '; tri[i] = atoi (length);} if ((Tri[0]+tri[1]>tri[2]) && (ABS (tri[0]-tri[1]) <tri[2]) cout << "YES"; elsecout << "NO";}
2015 Tian Qin Postgraduate examination simulation game A Judging Triangle