結果

問題 No.293 4>7の世界
ユーザー nanophoto12nanophoto12
提出日時 2015-11-23 22:17:55
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 1,234 bytes
コンパイル時間 2,941 ms
コンパイル使用メモリ 72,336 KB
実行使用メモリ 55,864 KB
最終ジャッジ日時 2023-08-28 21:56:47
合計ジャッジ時間 6,406 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,592 KB
testcase_01 AC 122 ms
55,524 KB
testcase_02 AC 122 ms
55,572 KB
testcase_03 AC 122 ms
55,836 KB
testcase_04 AC 121 ms
55,544 KB
testcase_05 AC 123 ms
55,832 KB
testcase_06 AC 123 ms
55,404 KB
testcase_07 AC 121 ms
55,524 KB
testcase_08 AC 121 ms
55,544 KB
testcase_09 AC 122 ms
55,864 KB
testcase_10 AC 121 ms
55,656 KB
testcase_11 AC 122 ms
55,640 KB
testcase_12 AC 123 ms
55,592 KB
testcase_13 AC 136 ms
53,888 KB
testcase_14 AC 129 ms
55,400 KB
testcase_15 AC 127 ms
55,596 KB
testcase_16 AC 122 ms
55,768 KB
testcase_17 AC 122 ms
55,692 KB
testcase_18 AC 121 ms
55,736 KB
testcase_19 AC 123 ms
55,420 KB
testcase_20 AC 121 ms
55,656 KB
testcase_21 AC 121 ms
55,412 KB
testcase_22 AC 120 ms
55,404 KB
testcase_23 AC 120 ms
55,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package com.company;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String left = scanner.next();
        String right = scanner.next();
        if(left.length() < right.length())
        {
            System.out.println(right);
            return;
        }
        if(left.length() > right.length())
        {
            System.out.println(left);
            return;
        }
        for(int i = 0;i < left.length();i++)
        {
            char leftValue = left.charAt(i);
            char rightValue = right.charAt(i);
            if(leftValue == rightValue)
            {
                continue;
            }
            if(leftValue == '7' && rightValue == '4')
            {
                System.out.println(right);
                return;
            }
            if(leftValue == '4' && rightValue == '7')
            {
                System.out.println(left);
                return;
            }
            if(leftValue > rightValue)
            {
                System.out.println(left);
                return;
            }
            System.out.println(right);
            return;
        }

    }
}
0