結果

問題 No.2030 Googol Strings
ユーザー polyesterpolyester
提出日時 2022-08-05 23:03:44
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,100 bytes
コンパイル時間 4,811 ms
コンパイル使用メモリ 106,320 KB
実行使用メモリ 7,052 KB
最終ジャッジ日時 2023-10-14 00:47:42
合計ジャッジ時間 7,032 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 17 ms
4,352 KB
testcase_02 AC 15 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 40 ms
7,052 KB
testcase_08 AC 42 ms
6,980 KB
testcase_09 AC 21 ms
4,348 KB
testcase_10 AC 21 ms
4,352 KB
testcase_11 AC 21 ms
4,352 KB
testcase_12 AC 40 ms
4,348 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string x, y;
    cin >> x >> y;
    int mini = min(x.size(), y.size());
    int maxi = max(x.size(), y.size());
    bool ok = false;
    for(int i = 0; i < mini; i++) {
      if(x[i] < y[i]) {
        cout << "Y" << endl;
        ok = true;
        break;
      }
      if(x[i] > y[i]) {
        cout << "X" << endl;
        ok = true;
        break;
      }
    }
    if(ok) {
      continue;
    }
    while(x.size() < maxi) {
      x.push_back('A');
    }
    while(y.size() < maxi) {
      y.push_back('A');
    }
    for(int i = 0; i < maxi; i++) {
      if(x[i] < y[i]) {
        cout << "Y" << endl;
        ok = true;
        break;
      }
      if(x[i] > y[i]) {
        cout << "X" << endl;
        ok = true;
        break;
      }
    }
  }
  return 0;
}
0