結果

問題 No.293 4>7の世界
ユーザー tsunabittsunabit
提出日時 2020-03-25 15:10:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 759 bytes
コンパイル時間 3,540 ms
コンパイル使用メモリ 74,692 KB
実行使用メモリ 56,048 KB
最終ジャッジ日時 2023-08-30 11:40:01
合計ジャッジ時間 7,710 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,996 KB
testcase_01 AC 122 ms
55,708 KB
testcase_02 AC 122 ms
55,432 KB
testcase_03 AC 122 ms
55,872 KB
testcase_04 AC 124 ms
55,748 KB
testcase_05 AC 124 ms
56,048 KB
testcase_06 AC 124 ms
55,676 KB
testcase_07 AC 123 ms
55,428 KB
testcase_08 AC 124 ms
55,600 KB
testcase_09 AC 123 ms
55,936 KB
testcase_10 AC 124 ms
55,760 KB
testcase_11 AC 125 ms
55,912 KB
testcase_12 AC 124 ms
55,512 KB
testcase_13 AC 121 ms
55,752 KB
testcase_14 AC 125 ms
55,440 KB
testcase_15 AC 124 ms
55,632 KB
testcase_16 AC 125 ms
55,744 KB
testcase_17 AC 125 ms
55,824 KB
testcase_18 AC 123 ms
55,660 KB
testcase_19 AC 124 ms
55,628 KB
testcase_20 AC 123 ms
55,600 KB
testcase_21 AC 127 ms
55,936 KB
testcase_22 AC 125 ms
55,876 KB
testcase_23 AC 126 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No293 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		String ans = "";
		if(a.length() != b.length()) {
			ans = a.length() > b.length() ? a : b;
		}else {
			for(int i = 0; i < a.length(); i++) {
				int z = Integer.parseInt(a.substring(i,i+1));
				int k = Integer.parseInt(b.substring(i,i+1));
				if((z==4 || z==7) && (k==4 || k==7)) {
					if(z < k) {
						ans= a;
						break;
					}else if(z > k) {
						ans = b;
						break;
					}
				}else {
					if(z < k) {
						ans= b;
						break;
					}else if(z > k) {
						ans = a;
						break;
					}
				}
			}
		}
		System.out.println(ans);
	}
}
0