結果

問題 No.293 4>7の世界
ユーザー TatsuDX
提出日時 2016-10-16 22:07:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 4,224 ms
コンパイル使用メモリ 75,440 KB
実行使用メモリ 41,364 KB
最終ジャッジ日時 2024-12-30 12:15:22
合計ジャッジ時間 8,565 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String s1 = sc.next(), s2 = sc.next();
		char c1, c2;
		if (s1.length() < s2.length()) {
			System.out.println(s2);
			return;
		} else if (s1.length() > s2.length()) {
			System.out.println(s1);
			return;
		} else {
			for (int i = 0; i < s1.length(); i++) {
				c1 = s1.charAt(i);
				c2 = s2.charAt(i);
				if (c1 == '4' && c2 == '7') {
					System.out.println(s1);
					return;
				} else if (c1 == '7' && c2 == '4') {
					System.out.println(s2);
					return;
				} else if (c1 > c2) {
					System.out.println(s1);
					return;
				} else if (c1 < c2) {
					System.out.println(s2);
					return;
				}
			}
		}
	}
}
0