結果

問題 No.293 4>7の世界
ユーザー spaciaspacia
提出日時 2016-01-09 10:01:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 739 bytes
コンパイル時間 2,167 ms
コンパイル使用メモリ 72,060 KB
実行使用メモリ 49,748 KB
最終ジャッジ日時 2023-08-28 22:02:17
合計ジャッジ時間 4,213 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,344 KB
testcase_01 AC 44 ms
49,200 KB
testcase_02 AC 44 ms
47,324 KB
testcase_03 AC 43 ms
49,580 KB
testcase_04 AC 44 ms
49,168 KB
testcase_05 AC 44 ms
49,364 KB
testcase_06 AC 44 ms
49,252 KB
testcase_07 AC 44 ms
49,360 KB
testcase_08 AC 43 ms
47,340 KB
testcase_09 AC 43 ms
49,332 KB
testcase_10 AC 43 ms
49,324 KB
testcase_11 AC 43 ms
49,388 KB
testcase_12 AC 43 ms
49,348 KB
testcase_13 AC 43 ms
49,188 KB
testcase_14 AC 43 ms
49,264 KB
testcase_15 AC 43 ms
49,260 KB
testcase_16 AC 43 ms
49,508 KB
testcase_17 AC 43 ms
49,348 KB
testcase_18 AC 43 ms
49,308 KB
testcase_19 AC 43 ms
49,520 KB
testcase_20 AC 43 ms
49,392 KB
testcase_21 AC 44 ms
49,748 KB
testcase_22 AC 44 ms
49,184 KB
testcase_23 AC 44 ms
49,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static String max (String a , String b) {
		if (a.length() != b.length())
			return a.length() > b.length() ? a : b;
		for (int i = 0; i < a.length(); i++) {
			int n = a.charAt(i) - '0';
			int m = b.charAt(i) - '0';
			if (n == 4 && m == 7) {
				return a;
			} else if (n == 7 && m == 4) {
				return b;
			} else if (n != m) {
				return n > m ? a : b;
			}
		}
		return a;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line = br.readLine().split(" ");
		
		out(max(line[0] , line[1]));
	}
}
0