結果

問題 No.293 4>7の世界
ユーザー scachescache
提出日時 2015-10-23 22:35:36
言語 Java19
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 931 bytes
コンパイル時間 4,538 ms
コンパイル使用メモリ 72,080 KB
実行使用メモリ 56,064 KB
最終ジャッジ日時 2023-08-28 21:47:54
合計ジャッジ時間 7,409 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,700 KB
testcase_01 AC 120 ms
53,616 KB
testcase_02 AC 117 ms
55,884 KB
testcase_03 AC 121 ms
55,876 KB
testcase_04 AC 120 ms
55,800 KB
testcase_05 AC 119 ms
55,628 KB
testcase_06 AC 119 ms
55,600 KB
testcase_07 AC 120 ms
56,064 KB
testcase_08 AC 118 ms
55,740 KB
testcase_09 AC 118 ms
55,784 KB
testcase_10 AC 118 ms
55,752 KB
testcase_11 AC 118 ms
55,476 KB
testcase_12 AC 124 ms
55,632 KB
testcase_13 AC 122 ms
55,704 KB
testcase_14 AC 120 ms
55,740 KB
testcase_15 AC 118 ms
55,592 KB
testcase_16 AC 119 ms
55,652 KB
testcase_17 AC 119 ms
55,752 KB
testcase_18 AC 118 ms
55,744 KB
testcase_19 AC 122 ms
55,988 KB
testcase_20 AC 119 ms
55,444 KB
testcase_21 AC 119 ms
55,772 KB
testcase_22 AC 120 ms
55,472 KB
testcase_23 AC 117 ms
55,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

/**
 * Created by scache on 15/10/23.
 */
public class Main293 {
    public static void main(String[] args){
        new Main293();
    }

    public Main293(){
        Scanner sc = new Scanner(System.in);
        String A = sc.next();
        String B = sc.next();

        String ret = A;
        if(A.length()!=B.length()) {
            ret = A.length() > B.length() ? A : B;
        }else{
            for(int i=0;i<A.length();i++) {
                if (A.charAt(i) == '4' && B.charAt(i) == '7' || A.charAt(i) == '7' && B.charAt(i) == '4') {
                    ret = A.charAt(i) == '4' ? A : B;
                    break;
                }

                if (A.charAt(i) != B.charAt(i)) {
                    ret = A.charAt(i) > B.charAt(i) ? A : B;
                    break;
                }
            }
        }

        System.out.println(ret);

    }

    private void solve(){

    }

}
0