//数の大きい⇔辞書順で遅い、だから辞書順比較をする。 //→間違い。”桁数が多いまたは辞書順で遅い”だった。 //→間違い。桁数を比較→同じなら辞書順比較だった。 #include #include using namespace std; char name[2][114514]; char point[2][114514]; char gomi[2][114514]; int comp(char *s1, char *s2) { int t = (strlen(s1) - strlen(s2)); int u = (strcmp(s1, s2)); if (t != 0) return t; return u; } int main() { cin >> name[0] >> point[0] >> gomi[0]; cin >> name[1] >> point[1] >> gomi[1]; if (comp(point[0], point[1]) > 0) cout << name[0] << endl; else if (comp(point[1], point[0]) > 0) cout << name[1] << endl; else cout << -1 << endl; return 0; }