結果

問題 No.293 4>7の世界
ユーザー htensaihtensai
提出日時 2019-11-22 19:39:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 685 bytes
コンパイル時間 2,181 ms
コンパイル使用メモリ 74,948 KB
実行使用メモリ 54,040 KB
最終ジャッジ日時 2024-04-19 10:20:21
合計ジャッジ時間 5,600 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
41,460 KB
testcase_01 AC 105 ms
41,416 KB
testcase_02 AC 103 ms
41,516 KB
testcase_03 AC 102 ms
41,528 KB
testcase_04 AC 100 ms
41,136 KB
testcase_05 AC 103 ms
41,284 KB
testcase_06 AC 106 ms
40,424 KB
testcase_07 WA -
testcase_08 AC 94 ms
41,396 KB
testcase_09 AC 107 ms
40,084 KB
testcase_10 AC 111 ms
41,480 KB
testcase_11 AC 94 ms
41,528 KB
testcase_12 AC 95 ms
41,816 KB
testcase_13 AC 102 ms
41,312 KB
testcase_14 AC 99 ms
41,304 KB
testcase_15 AC 99 ms
41,180 KB
testcase_16 AC 106 ms
41,704 KB
testcase_17 AC 101 ms
41,424 KB
testcase_18 AC 111 ms
41,116 KB
testcase_19 AC 115 ms
41,160 KB
testcase_20 AC 109 ms
41,160 KB
testcase_21 AC 111 ms
41,176 KB
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		if (a.length() > b.length()) {
		    System.out.println(a);
		} else if (a.length() < b.length())  {
		    System.out.println(b);
		} else {
		    for (int i = 0; i < a.length(); i++) {
		        char ca = a.charAt(i);
		        char cb = b.charAt(i);
		        if ((ca == '4' && cb == '7') || ca > cb) {
		            System.out.println(a);
		            return;
		        } else if ((ca == '7' && cb == '4') || ca < cb) {
		            System.out.println(b);
		            return;
		        }
		    }
		}
	}
}
0