結果

問題 No.293 4>7の世界
ユーザー atkrymatkrym
提出日時 2016-10-19 17:14:18
言語 Java19
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 1,056 bytes
コンパイル時間 3,065 ms
コンパイル使用メモリ 73,568 KB
実行使用メモリ 56,096 KB
最終ジャッジ日時 2023-08-28 22:15:22
合計ジャッジ時間 7,238 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,356 KB
testcase_01 AC 119 ms
55,672 KB
testcase_02 AC 121 ms
55,748 KB
testcase_03 AC 120 ms
55,528 KB
testcase_04 AC 120 ms
55,600 KB
testcase_05 AC 121 ms
55,748 KB
testcase_06 AC 120 ms
55,556 KB
testcase_07 AC 121 ms
56,032 KB
testcase_08 AC 120 ms
55,724 KB
testcase_09 AC 120 ms
55,568 KB
testcase_10 AC 121 ms
56,060 KB
testcase_11 AC 119 ms
55,644 KB
testcase_12 AC 121 ms
55,352 KB
testcase_13 AC 121 ms
55,644 KB
testcase_14 AC 120 ms
55,408 KB
testcase_15 AC 120 ms
55,904 KB
testcase_16 AC 120 ms
55,584 KB
testcase_17 AC 119 ms
55,652 KB
testcase_18 AC 119 ms
56,096 KB
testcase_19 AC 120 ms
53,868 KB
testcase_20 AC 120 ms
55,420 KB
testcase_21 AC 119 ms
55,884 KB
testcase_22 AC 119 ms
56,052 KB
testcase_23 AC 119 ms
55,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String a = sc.next();
        String b = sc.next();
        int la = a.length();
        int lb = b.length();
        if (la > lb) {
            System.out.println(a);
            return;
        } else if (lb > la) {
            System.out.println(b);
            return;
        }
        
        for (int i = 0;i < la;i++) {
            int ai = Integer.parseInt(a.substring(i,i+1));
            int bi = Integer.parseInt(b.substring(i,i+1));
            if (ai == bi) continue;
            if (ai == 4 && bi == 7) {
                System.out.println(a);
            } else if (ai == 7 && bi == 4) {
                System.out.println(b);
            } else {
                if (ai > bi) {
                    System.out.println(a);
                } else if (bi > ai) {
                    System.out.println(b);
                }
            }
            return;
        }
    }
}
0