結果

問題 No.293 4>7の世界
ユーザー Mcpu3Mcpu3
提出日時 2018-10-16 20:03:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 746 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 71,760 KB
実行使用メモリ 56,208 KB
最終ジャッジ日時 2023-08-28 22:26:45
合計ジャッジ時間 5,909 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,436 KB
testcase_01 AC 118 ms
55,804 KB
testcase_02 AC 118 ms
55,720 KB
testcase_03 AC 118 ms
55,412 KB
testcase_04 AC 117 ms
55,656 KB
testcase_05 AC 117 ms
55,552 KB
testcase_06 AC 118 ms
53,824 KB
testcase_07 AC 119 ms
55,692 KB
testcase_08 AC 119 ms
55,612 KB
testcase_09 AC 118 ms
55,736 KB
testcase_10 AC 116 ms
55,640 KB
testcase_11 AC 118 ms
56,048 KB
testcase_12 AC 122 ms
55,972 KB
testcase_13 AC 121 ms
53,628 KB
testcase_14 AC 120 ms
56,072 KB
testcase_15 AC 120 ms
56,208 KB
testcase_16 AC 119 ms
55,600 KB
testcase_17 AC 118 ms
55,628 KB
testcase_18 AC 118 ms
55,924 KB
testcase_19 AC 120 ms
55,636 KB
testcase_20 AC 121 ms
55,324 KB
testcase_21 AC 120 ms
55,752 KB
testcase_22 AC 117 ms
55,768 KB
testcase_23 AC 117 ms
55,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String A = sc.next(), B = sc.next();
		sc.close();
		if (A.length() > B.length()) System.out.print(A);
		else if (A.length() < B.length()) System.out.print(B);
		else {
			for (int i = 0; i < A.length(); ++i) {
				if (A.charAt(i) == '4' && B.charAt(i) == '7') {
					System.out.print(A);
					break;
				}
				else if (A.charAt(i) == '7' && B.charAt(i) == '4') {
					System.out.print(B);
					break;
				}
				else if (A.charAt(i) > B.charAt(i)) {
					System.out.print(A);
					break;
				}
				else if (A.charAt(i) < B.charAt(i)) {
					System.out.print(B);
					break;
				}
			}
		}
	}
}
0