結果

問題 No.293 4>7の世界
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-20 12:35:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 718 bytes
コンパイル時間 2,055 ms
コンパイル使用メモリ 78,224 KB
実行使用メモリ 56,460 KB
最終ジャッジ日時 2023-08-28 22:27:24
合計ジャッジ時間 6,237 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,548 KB
testcase_01 AC 125 ms
55,792 KB
testcase_02 AC 124 ms
55,684 KB
testcase_03 AC 125 ms
55,740 KB
testcase_04 AC 126 ms
55,696 KB
testcase_05 AC 123 ms
56,052 KB
testcase_06 AC 122 ms
55,972 KB
testcase_07 AC 121 ms
55,744 KB
testcase_08 AC 124 ms
56,084 KB
testcase_09 AC 123 ms
56,460 KB
testcase_10 AC 122 ms
56,016 KB
testcase_11 AC 126 ms
55,856 KB
testcase_12 AC 125 ms
55,620 KB
testcase_13 AC 125 ms
55,996 KB
testcase_14 AC 125 ms
55,740 KB
testcase_15 AC 125 ms
55,896 KB
testcase_16 AC 127 ms
55,972 KB
testcase_17 AC 124 ms
55,564 KB
testcase_18 AC 126 ms
55,824 KB
testcase_19 AC 124 ms
55,684 KB
testcase_20 AC 124 ms
55,804 KB
testcase_21 AC 125 ms
55,772 KB
testcase_22 AC 124 ms
55,844 KB
testcase_23 AC 125 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a=scanner.nextInt();
		int b=scanner.nextInt();
		String sa=String.valueOf(a);
		String sb=String.valueOf(b);
		if(sa.length()>sb.length()){
			System.out.println(sa);
		}else if(sa.length()<sb.length()){
			System.out.println(sb);
		}else{
			for(int i=0;i<sa.length();i++){
				int ta=sa.charAt(i)-'0';
				int tb=sb.charAt(i)-'0';
				if((ta>tb&&!(ta==7&&tb==4))||(ta==4&&tb==7)){
					System.out.println(sa);
					return;
				}else if((tb>ta&&!(ta==4&&tb==7))||(ta==7&&tb==4)){
					System.out.println(sb);
					return;
				}
			}
		}
		
	}
}
0