結果

問題 No.293 4>7の世界
ユーザー rf141rf141
提出日時 2015-12-19 19:09:09
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 843 bytes
コンパイル時間 1,805 ms
コンパイル使用メモリ 74,088 KB
実行使用メモリ 56,504 KB
最終ジャッジ日時 2023-10-14 22:34:09
合計ジャッジ時間 5,630 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,048 KB
testcase_01 AC 116 ms
55,956 KB
testcase_02 AC 117 ms
55,948 KB
testcase_03 AC 117 ms
56,240 KB
testcase_04 AC 118 ms
55,716 KB
testcase_05 AC 116 ms
55,952 KB
testcase_06 AC 119 ms
55,864 KB
testcase_07 AC 118 ms
55,876 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 116 ms
55,700 KB
testcase_11 AC 116 ms
55,964 KB
testcase_12 AC 116 ms
55,920 KB
testcase_13 AC 117 ms
55,896 KB
testcase_14 AC 117 ms
55,932 KB
testcase_15 AC 116 ms
56,252 KB
testcase_16 AC 117 ms
56,500 KB
testcase_17 AC 115 ms
56,196 KB
testcase_18 AC 116 ms
55,528 KB
testcase_19 AC 115 ms
55,976 KB
testcase_20 AC 117 ms
56,396 KB
testcase_21 AC 118 ms
55,756 KB
testcase_22 AC 116 ms
54,200 KB
testcase_23 AC 119 ms
56,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();

		if(a < b){
			System.out.println(getResult(b,a));
		}else if(b < a){
			System.out.println(getResult(a,b));
		}else{
			System.out.println(a);
		}
	}

	public static int getResult(int l,int s){
		String l_s = String.valueOf(l);
		String s_s = String.valueOf(s);
		if(l_s.length() != s_s.length())return l;
		if(l_s.indexOf("7") == -1 && s_s.indexOf("7") == -1)return l;
		int result = l;
		for(int i = 0; i < l_s.length(); i++){
			if(l_s.charAt(i) != s_s.charAt(i)){
				if(l_s.charAt(i) == '4' && s_s.charAt(i) == '7'){
					break;
				}else if(s_s.charAt(i) == '4' && l_s.charAt(i) == '7'){
					result = s;
					break;
				}
			}
		}

		return result;
	}
}
0