結果

問題 No.293 4>7の世界
ユーザー tsunabittsunabit
提出日時 2020-03-25 15:09:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 944 bytes
コンパイル時間 5,409 ms
コンパイル使用メモリ 75,396 KB
実行使用メモリ 56,004 KB
最終ジャッジ日時 2023-08-30 11:39:51
合計ジャッジ時間 9,121 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,748 KB
testcase_01 AC 121 ms
55,576 KB
testcase_02 AC 121 ms
56,004 KB
testcase_03 AC 122 ms
55,904 KB
testcase_04 AC 120 ms
55,784 KB
testcase_05 AC 122 ms
55,524 KB
testcase_06 AC 121 ms
55,552 KB
testcase_07 AC 122 ms
55,448 KB
testcase_08 AC 122 ms
55,884 KB
testcase_09 AC 123 ms
55,756 KB
testcase_10 AC 124 ms
55,628 KB
testcase_11 AC 125 ms
55,720 KB
testcase_12 AC 123 ms
55,756 KB
testcase_13 AC 124 ms
55,752 KB
testcase_14 AC 124 ms
55,824 KB
testcase_15 AC 124 ms
53,848 KB
testcase_16 AC 123 ms
53,980 KB
testcase_17 AC 124 ms
55,428 KB
testcase_18 AC 122 ms
55,736 KB
testcase_19 AC 119 ms
55,700 KB
testcase_20 AC 127 ms
55,956 KB
testcase_21 AC 125 ms
53,700 KB
testcase_22 AC 124 ms
55,672 KB
testcase_23 AC 122 ms
55,576 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);

//		String aa = a.replace('4', '8');
//		String bb = b.replace('4', '8');
//		if(Integer.parseInt(aa) > Integer.parseInt(bb)) System.out.println(a);
//		else System.out.println(b);
		
	}
}
0