結果

問題 No.293 4>7の世界
ユーザー YamaKasaYamaKasa
提出日時 2018-09-09 23:30:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 767 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 74,204 KB
実行使用メモリ 56,336 KB
最終ジャッジ日時 2023-08-28 22:26:19
合計ジャッジ時間 5,966 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,756 KB
testcase_01 AC 118 ms
55,596 KB
testcase_02 AC 118 ms
55,624 KB
testcase_03 AC 119 ms
55,744 KB
testcase_04 AC 118 ms
55,976 KB
testcase_05 AC 118 ms
55,776 KB
testcase_06 AC 119 ms
55,628 KB
testcase_07 AC 117 ms
55,952 KB
testcase_08 AC 117 ms
56,048 KB
testcase_09 AC 115 ms
56,288 KB
testcase_10 AC 117 ms
56,264 KB
testcase_11 AC 118 ms
55,632 KB
testcase_12 AC 115 ms
55,708 KB
testcase_13 AC 116 ms
56,256 KB
testcase_14 AC 116 ms
56,108 KB
testcase_15 AC 115 ms
53,600 KB
testcase_16 AC 118 ms
55,632 KB
testcase_17 AC 116 ms
55,784 KB
testcase_18 AC 119 ms
55,604 KB
testcase_19 AC 116 ms
55,948 KB
testcase_20 AC 116 ms
56,212 KB
testcase_21 AC 116 ms
56,292 KB
testcase_22 AC 117 ms
55,460 KB
testcase_23 AC 121 ms
56,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String A = scan.next();
		String B = scan.next();
		scan.close();
		int l1 = A.length();
		int l2 = B.length();
		if(l1 > l2) {
			System.out.println(A);
		}else if(l1 < l2) {
			System.out.println(B);
		}else {
			for(int i = 0; i < l1; i++) {
				char c1 = A.charAt(i);
				char c2 = B.charAt(i);
				if(c1 == '4' && c2 == '7') {
					System.out.println(A);
					System.exit(0);
				}else if(c1 == '7' && c2 == '4') {
					System.out.println(B);
					System.exit(0);
				}else if(c1 > c2) {
					System.out.println(A);
					System.exit(0);
				}else if(c1 < c2) {
					System.out.println(B);
					System.exit(0);
				}
			}
		}

	}
}
0