結果

問題 No.207 世界のなんとか
ユーザー atkrymatkrym
提出日時 2016-10-19 14:20:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 587 bytes
コンパイル時間 2,337 ms
コンパイル使用メモリ 74,276 KB
実行使用メモリ 41,668 KB
最終ジャッジ日時 2024-05-02 05:28:13
合計ジャッジ時間 5,587 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
40,976 KB
testcase_01 AC 114 ms
40,052 KB
testcase_02 AC 143 ms
41,384 KB
testcase_03 AC 142 ms
41,300 KB
testcase_04 AC 135 ms
41,220 KB
testcase_05 AC 132 ms
41,104 KB
testcase_06 AC 136 ms
41,344 KB
testcase_07 AC 134 ms
41,264 KB
testcase_08 AC 130 ms
41,196 KB
testcase_09 AC 137 ms
41,668 KB
testcase_10 AC 121 ms
40,108 KB
testcase_11 AC 134 ms
41,360 KB
testcase_12 AC 137 ms
41,268 KB
testcase_13 AC 136 ms
41,216 KB
testcase_14 AC 120 ms
40,200 KB
testcase_15 AC 138 ms
41,432 KB
testcase_16 AC 132 ms
41,236 KB
testcase_17 AC 135 ms
41,328 KB
testcase_18 AC 132 ms
41,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        for (int i = a;i <= b;i++) {
            if (isContain(i) || isMod(i)) {
                System.out.println(i);
            }
        }
    }
    
    private static boolean isContain(int i) {
        String s = String.valueOf(i);
        return s.indexOf("3") >= 0;
    }
    
    private static boolean isMod(int i) {
        return i%3==0;
    }
}
0