結果

問題 No.293 4>7の世界
ユーザー t8m8⛄️t8m8⛄️
提出日時 2016-01-25 17:45:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 996 bytes
コンパイル時間 3,775 ms
コンパイル使用メモリ 76,272 KB
実行使用メモリ 55,968 KB
最終ジャッジ日時 2023-08-28 22:03:08
合計ジャッジ時間 8,019 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,684 KB
testcase_01 AC 122 ms
55,788 KB
testcase_02 AC 122 ms
55,764 KB
testcase_03 AC 122 ms
54,304 KB
testcase_04 AC 125 ms
55,720 KB
testcase_05 AC 124 ms
55,432 KB
testcase_06 AC 123 ms
55,968 KB
testcase_07 AC 123 ms
55,736 KB
testcase_08 AC 122 ms
55,632 KB
testcase_09 AC 125 ms
55,616 KB
testcase_10 AC 125 ms
55,776 KB
testcase_11 AC 125 ms
55,760 KB
testcase_12 AC 124 ms
55,896 KB
testcase_13 AC 125 ms
55,712 KB
testcase_14 AC 122 ms
55,760 KB
testcase_15 AC 121 ms
55,784 KB
testcase_16 AC 121 ms
55,728 KB
testcase_17 AC 121 ms
55,964 KB
testcase_18 AC 124 ms
55,688 KB
testcase_19 AC 123 ms
55,700 KB
testcase_20 AC 122 ms
55,716 KB
testcase_21 AC 124 ms
55,572 KB
testcase_22 AC 124 ms
55,616 KB
testcase_23 AC 135 ms
55,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No0292 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		String a = in.next();
		String b = in.next();
		int n = a.length();
		int m = b.length();

		if (n != m) {
			out.println(n > m ? a : b);
			return;
		}

		for (int i=0; i<n; i++) {
			if (a.charAt(i) != b.charAt(i)) {
				if ((a.charAt(i) == '4' || a.charAt(i) == '7') && (b.charAt(i) == '4' || b.charAt(i) == '7'))
					out.println(a.charAt(i) == '4' ? a : b);
				else
					out.println(a.charAt(i) > b.charAt(i) ? a : b);
				return;
			}
		}
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}
0