結果

問題 No.293 4>7の世界
ユーザー kou6839kou6839
提出日時 2015-10-24 01:26:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 699 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 74,416 KB
実行使用メモリ 56,228 KB
最終ジャッジ日時 2023-08-28 21:52:11
合計ジャッジ時間 6,047 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,596 KB
testcase_01 AC 117 ms
56,220 KB
testcase_02 AC 119 ms
55,964 KB
testcase_03 AC 122 ms
56,228 KB
testcase_04 AC 118 ms
55,908 KB
testcase_05 AC 119 ms
55,816 KB
testcase_06 AC 118 ms
55,728 KB
testcase_07 AC 117 ms
55,792 KB
testcase_08 AC 119 ms
56,220 KB
testcase_09 AC 119 ms
56,008 KB
testcase_10 AC 118 ms
55,696 KB
testcase_11 AC 117 ms
55,744 KB
testcase_12 AC 117 ms
56,104 KB
testcase_13 AC 118 ms
56,104 KB
testcase_14 AC 117 ms
55,628 KB
testcase_15 AC 118 ms
55,872 KB
testcase_16 AC 118 ms
55,624 KB
testcase_17 AC 117 ms
55,692 KB
testcase_18 AC 117 ms
55,940 KB
testcase_19 AC 118 ms
56,008 KB
testcase_20 AC 118 ms
55,740 KB
testcase_21 AC 120 ms
55,608 KB
testcase_22 AC 119 ms
55,972 KB
testcase_23 AC 119 ms
55,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String a = sc.next();
		String b = sc.next();
		
		if(a.length()<b.length()){
			System.out.println(b);
		}else if(a.length()>b.length()){
			System.out.println(a);
		}else{
			for(int i=0;i<a.length();i++){
				if(a.charAt(i)==b.charAt(i)) continue;
				if(a.charAt(i)=='4'&&b.charAt(i)=='7'){
					System.out.println(a);
				}else if(a.charAt(i)=='7'&&b.charAt(i)=='4'){
					System.out.println(b);
					
				}else{
					if((int)a.charAt(i)<(int)b.charAt(i)){
						System.out.println(b);
					}else{
						System.out.println(a);
					}
				}
				return;
			}
		}
	}
}
0