結果

問題 No.293 4>7の世界
ユーザー samplelpmassamplelpmas
提出日時 2017-04-23 01:26:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 1,042 bytes
コンパイル時間 2,553 ms
コンパイル使用メモリ 72,240 KB
実行使用メモリ 56,284 KB
最終ジャッジ日時 2023-08-28 22:19:50
合計ジャッジ時間 5,988 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,400 KB
testcase_01 AC 119 ms
55,784 KB
testcase_02 AC 120 ms
55,928 KB
testcase_03 AC 120 ms
55,956 KB
testcase_04 AC 120 ms
55,396 KB
testcase_05 AC 120 ms
55,888 KB
testcase_06 AC 119 ms
55,456 KB
testcase_07 AC 121 ms
55,980 KB
testcase_08 AC 121 ms
55,908 KB
testcase_09 AC 118 ms
55,684 KB
testcase_10 AC 117 ms
56,284 KB
testcase_11 AC 117 ms
55,832 KB
testcase_12 AC 118 ms
55,556 KB
testcase_13 AC 117 ms
55,832 KB
testcase_14 AC 115 ms
55,676 KB
testcase_15 AC 117 ms
55,572 KB
testcase_16 AC 116 ms
55,764 KB
testcase_17 AC 117 ms
55,752 KB
testcase_18 AC 116 ms
55,732 KB
testcase_19 AC 118 ms
55,628 KB
testcase_20 AC 115 ms
55,384 KB
testcase_21 AC 114 ms
55,984 KB
testcase_22 AC 119 ms
55,752 KB
testcase_23 AC 117 ms
55,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        char[] A = sc.next().toCharArray();
        char[] B = sc.next().toCharArray();

        if (A.length > B.length) {
            System.out.println(A);
            return;
        } else if (A.length < B.length) {
            System.out.println(B);
            return;
        }

        for (int i = 0; i < A.length; i++) {

            if (A[i] != B[i]) {

                if (A[i] == '4' && B[i] == '7') {
                    System.out.println(A);
                    break;
                } else if (A[i] == '7' && B[i] == '4') {
                    System.out.println(B);
                    break;
                }

                if (A[i] > B[i]) {
                    System.out.println(A);
                    break;
                } else if (A[i] < B[i]){
                    System.out.println(B);
                    break;
                }

            }

        }

    }

}
0