結果

問題 No.2030 Googol Strings
ユーザー tentententen
提出日時 2022-08-08 17:52:24
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,401 bytes
コンパイル時間 2,524 ms
コンパイル使用メモリ 80,160 KB
実行使用メモリ 64,148 KB
最終ジャッジ日時 2023-10-19 06:49:40
合計ジャッジ時間 8,571 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 203 ms
58,056 KB
testcase_01 AC 213 ms
59,232 KB
testcase_02 AC 183 ms
57,748 KB
testcase_03 AC 66 ms
52,960 KB
testcase_04 WA -
testcase_05 AC 200 ms
59,188 KB
testcase_06 AC 223 ms
62,768 KB
testcase_07 AC 246 ms
64,104 KB
testcase_08 AC 244 ms
64,148 KB
testcase_09 AC 203 ms
58,980 KB
testcase_10 AC 232 ms
59,180 KB
testcase_11 AC 221 ms
57,004 KB
testcase_12 AC 204 ms
58,300 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 231 ms
59,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        while (n-- > 0) {
            if (compare(sc.next(), sc.next()) < 0) {
                sb.append("Y\n");
            } else {
                sb.append("X\n");
            }
        }
        System.out.print(sb);
    }
    
    static int compare(String x, String y) {
        String xx = x + y;
        String yy = y + y;
        if (xx.equals(yy)) {
            return x.length() - y.length();
        } else {
            return xx.compareTo(yy);
        }
    }
}

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0