結果

問題 No.293 4>7の世界
ユーザー uafr_csuafr_cs
提出日時 2015-10-23 22:40:15
言語 Java19
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 925 bytes
コンパイル時間 2,074 ms
コンパイル使用メモリ 74,308 KB
実行使用メモリ 56,496 KB
最終ジャッジ日時 2023-08-28 21:49:39
合計ジャッジ時間 6,159 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,704 KB
testcase_01 AC 124 ms
55,756 KB
testcase_02 AC 124 ms
55,936 KB
testcase_03 AC 123 ms
55,956 KB
testcase_04 AC 124 ms
55,980 KB
testcase_05 AC 125 ms
55,876 KB
testcase_06 AC 123 ms
56,280 KB
testcase_07 AC 124 ms
55,824 KB
testcase_08 AC 124 ms
56,176 KB
testcase_09 AC 124 ms
56,496 KB
testcase_10 AC 125 ms
55,848 KB
testcase_11 AC 124 ms
55,948 KB
testcase_12 AC 125 ms
55,540 KB
testcase_13 AC 126 ms
56,040 KB
testcase_14 AC 124 ms
55,884 KB
testcase_15 AC 126 ms
56,048 KB
testcase_16 AC 125 ms
56,012 KB
testcase_17 AC 125 ms
55,936 KB
testcase_18 AC 124 ms
55,944 KB
testcase_19 AC 124 ms
55,572 KB
testcase_20 AC 126 ms
55,660 KB
testcase_21 AC 125 ms
56,004 KB
testcase_22 AC 124 ms
54,072 KB
testcase_23 AC 124 ms
55,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final long A = sc.nextLong();
		final long B = sc.nextLong();
		
		final char[] A_ch = Long.toString(A).toCharArray();
		final char[] B_ch = Long.toString(B).toCharArray();
		
		if(A_ch.length < B_ch.length){
			System.out.println(B);
		}else if(A_ch.length > B_ch.length){
			System.out.println(A);
		}else{
			for(int i = 0; i < A_ch.length; i++){
				if(A_ch[i] == '4' && B_ch[i] == '7'){
					System.out.println(A);
					break;
				}else if(A_ch[i] == '7' && B_ch[i] == '4'){
					System.out.println(B);
					break;
				}else if(A_ch[i] > B_ch[i]){
					System.out.println(A);
					break;
				}else if(A_ch[i] < B_ch[i]){
					System.out.println(B);
					break;
				}
			}
		}
		
	}

}
0