結果

問題 No.207 世界のなんとか
ユーザー oyafusooyafuso
提出日時 2019-03-11 14:45:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 1,089 bytes
コンパイル時間 2,106 ms
コンパイル使用メモリ 72,628 KB
実行使用メモリ 56,200 KB
最終ジャッジ日時 2023-09-05 20:07:38
合計ジャッジ時間 5,473 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,736 KB
testcase_01 AC 121 ms
55,728 KB
testcase_02 AC 127 ms
56,200 KB
testcase_03 AC 125 ms
55,876 KB
testcase_04 AC 123 ms
55,780 KB
testcase_05 AC 125 ms
56,116 KB
testcase_06 AC 122 ms
55,700 KB
testcase_07 AC 123 ms
55,708 KB
testcase_08 AC 121 ms
55,720 KB
testcase_09 AC 127 ms
56,024 KB
testcase_10 AC 127 ms
55,548 KB
testcase_11 AC 126 ms
55,792 KB
testcase_12 AC 132 ms
55,804 KB
testcase_13 AC 129 ms
55,760 KB
testcase_14 AC 130 ms
55,956 KB
testcase_15 AC 130 ms
55,784 KB
testcase_16 AC 124 ms
55,848 KB
testcase_17 AC 124 ms
53,808 KB
testcase_18 AC 124 ms
55,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {

	private static final String SPLIT_STR = " ";
	private static final int SEARCH_NUM = 3;

	public static void main(String[] args) {
		// Scanner生成
		Scanner sc = new Scanner(System.in);
		// 入力設定
		String input = sc.nextLine();
		String[] split = input.split(SPLIT_STR);
		List<Integer> numList = new ArrayList<>(split.length);
		for (int i = 0; i < split.length; i++) {
			numList.add(Integer.parseInt(split[i]));
		}
		// Scannerクローズ
		sc.close();

		/* メイン処理開始 */
		// 変数初期化
		int result = 0;
		int A = numList.get(0);
		int B = numList.get(1);
		List<Integer> list = new ArrayList<>();

		for (int i = A; i <= B; i++) {
			if (i % SEARCH_NUM == 0 || isContain(i, SEARCH_NUM)) {
				// 結果出力
				System.out.println(i);
			}
		}
		/* メイン処理終了 */
	}

	// num1にnum2が含まれていればtrue, 含まれていないfalse
	private static boolean isContain(int num1, int num2) {
		String str1 = String.valueOf(num1);
		String str2 = String.valueOf(num2);
		return str1.contains(str2);
	}
}
0