結果

問題 No.207 世界のなんとか
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-30 14:24:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 861 bytes
コンパイル時間 3,589 ms
コンパイル使用メモリ 71,452 KB
実行使用メモリ 49,472 KB
最終ジャッジ日時 2023-10-11 23:39:34
合計ジャッジ時間 5,669 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
49,292 KB
testcase_01 AC 43 ms
49,284 KB
testcase_02 AC 47 ms
49,472 KB
testcase_03 AC 45 ms
48,980 KB
testcase_04 AC 45 ms
49,392 KB
testcase_05 AC 45 ms
49,292 KB
testcase_06 AC 43 ms
49,256 KB
testcase_07 AC 44 ms
49,184 KB
testcase_08 AC 43 ms
49,356 KB
testcase_09 AC 45 ms
48,984 KB
testcase_10 AC 46 ms
49,356 KB
testcase_11 AC 45 ms
49,124 KB
testcase_12 AC 46 ms
48,956 KB
testcase_13 AC 46 ms
49,112 KB
testcase_14 AC 47 ms
49,128 KB
testcase_15 AC 46 ms
49,144 KB
testcase_16 AC 43 ms
47,420 KB
testcase_17 AC 43 ms
49,288 KB
testcase_18 AC 43 ms
48,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.System.in;


public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] inputs = reader.readLine().split(" ");
        long A = Long.parseLong(inputs[0]);
        long B = Long.parseLong(inputs[1]);
        for (long i = A; i <= B; i++) {
            if (i % 3 == 0 || containsThree(i)) {
                System.out.println(i);
            }
        }
    }
    
    private static boolean containsThree(long n) {
        String ns = String.valueOf(n);
        for (int i = 0; i < ns.length(); i++) {
            if (ns.charAt(i) == '3') {
                return true;
            }
        }
        return false;
    }
}
0