結果

問題 No.293 4>7の世界
ユーザー TatsuDXTatsuDX
提出日時 2016-10-16 22:07:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 3,132 ms
コンパイル使用メモリ 72,744 KB
実行使用メモリ 56,276 KB
最終ジャッジ日時 2023-08-28 22:14:30
合計ジャッジ時間 7,096 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,760 KB
testcase_01 AC 118 ms
55,844 KB
testcase_02 AC 118 ms
55,936 KB
testcase_03 AC 117 ms
55,648 KB
testcase_04 AC 117 ms
55,700 KB
testcase_05 AC 117 ms
55,400 KB
testcase_06 AC 118 ms
55,732 KB
testcase_07 AC 117 ms
55,892 KB
testcase_08 AC 119 ms
55,760 KB
testcase_09 AC 118 ms
55,924 KB
testcase_10 AC 117 ms
55,916 KB
testcase_11 AC 116 ms
56,272 KB
testcase_12 AC 118 ms
55,828 KB
testcase_13 AC 117 ms
56,276 KB
testcase_14 AC 118 ms
55,676 KB
testcase_15 AC 120 ms
55,676 KB
testcase_16 AC 119 ms
55,636 KB
testcase_17 AC 121 ms
56,044 KB
testcase_18 AC 121 ms
55,780 KB
testcase_19 AC 120 ms
55,948 KB
testcase_20 AC 120 ms
56,232 KB
testcase_21 AC 121 ms
55,920 KB
testcase_22 AC 121 ms
55,812 KB
testcase_23 AC 120 ms
55,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String s1 = sc.next(), s2 = sc.next();
		char c1, c2;
		if (s1.length() < s2.length()) {
			System.out.println(s2);
			return;
		} else if (s1.length() > s2.length()) {
			System.out.println(s1);
			return;
		} else {
			for (int i = 0; i < s1.length(); i++) {
				c1 = s1.charAt(i);
				c2 = s2.charAt(i);
				if (c1 == '4' && c2 == '7') {
					System.out.println(s1);
					return;
				} else if (c1 == '7' && c2 == '4') {
					System.out.println(s2);
					return;
				} else if (c1 > c2) {
					System.out.println(s1);
					return;
				} else if (c1 < c2) {
					System.out.println(s2);
					return;
				}
			}
		}
	}
}
0