結果

問題 No.207 世界のなんとか
ユーザー yagi2yagi2
提出日時 2017-04-14 00:52:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 826 bytes
コンパイル時間 2,180 ms
コンパイル使用メモリ 72,284 KB
実行使用メモリ 56,244 KB
最終ジャッジ日時 2023-09-25 16:33:05
合計ジャッジ時間 5,756 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,244 KB
testcase_01 AC 117 ms
53,836 KB
testcase_02 AC 125 ms
56,044 KB
testcase_03 AC 122 ms
55,748 KB
testcase_04 AC 121 ms
55,960 KB
testcase_05 AC 125 ms
55,716 KB
testcase_06 AC 122 ms
55,700 KB
testcase_07 AC 122 ms
55,492 KB
testcase_08 AC 124 ms
55,660 KB
testcase_09 AC 127 ms
56,224 KB
testcase_10 AC 130 ms
53,688 KB
testcase_11 AC 125 ms
56,104 KB
testcase_12 AC 125 ms
56,012 KB
testcase_13 AC 125 ms
55,704 KB
testcase_14 AC 129 ms
55,936 KB
testcase_15 AC 127 ms
56,140 KB
testcase_16 AC 117 ms
55,640 KB
testcase_17 AC 123 ms
55,376 KB
testcase_18 AC 119 ms
55,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long A = Long.parseLong(sc.next());
        long B = Long.parseLong(sc.next());

        for (long i = A; i <= B; i++) {
            boolean isNabeatsu = false;
            if (i % 3 == 0 || i % 30 == 0) {
                isNabeatsu = true;
            } else {
                String s = String.valueOf(i);
                String[] sp = s.split("");

                for (int j = 0; j < sp.length; j++) {
                    if (sp[j].equals("3")) {
                        isNabeatsu = true;
                        break;
                    }
                }
            }
            if (isNabeatsu) {
                System.out.println(i);
            }
        }
    }
}
0