結果

問題 No.2030 Googol Strings
ユーザー ShirotsumeShirotsume
提出日時 2022-07-15 02:51:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 480 ms / 2,000 ms
コード長 795 bytes
コンパイル時間 2,074 ms
コンパイル使用メモリ 74,244 KB
実行使用メモリ 65,888 KB
最終ジャッジ日時 2023-09-09 03:46:25
合計ジャッジ時間 11,367 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 471 ms
61,716 KB
testcase_01 AC 310 ms
59,692 KB
testcase_02 AC 341 ms
59,012 KB
testcase_03 AC 125 ms
55,720 KB
testcase_04 AC 457 ms
60,956 KB
testcase_05 AC 299 ms
59,516 KB
testcase_06 AC 302 ms
63,184 KB
testcase_07 AC 360 ms
65,540 KB
testcase_08 AC 367 ms
65,888 KB
testcase_09 AC 317 ms
59,700 KB
testcase_10 AC 329 ms
59,676 KB
testcase_11 AC 355 ms
59,844 KB
testcase_12 AC 480 ms
61,720 KB
testcase_13 AC 424 ms
59,968 KB
testcase_14 AC 367 ms
59,732 KB
testcase_15 AC 411 ms
59,476 KB
testcase_16 AC 469 ms
59,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int t = sc.nextInt();
	        for(int i = 0; i < t; i++){
                String x = sc.next();
                String y = sc.next();
                int p = (x + y).compareTo(y + x);
                if(p > 0){
                    System.out.println("X");
                }
                else if (p < 0){
                    System.out.println("Y");
                }
                else{
                    if(x.length() > y.length()){
                        System.out.println("X");
                    }
                    else{
                        System.out.println("Y");
                    }
                }
				
	        }
	    }
}
0