結果

問題 No.207 世界のなんとか
ユーザー show258show258
提出日時 2017-03-29 20:02:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 578 bytes
コンパイル時間 3,925 ms
コンパイル使用メモリ 72,984 KB
実行使用メモリ 56,188 KB
最終ジャッジ日時 2023-09-20 20:15:00
合計ジャッジ時間 7,263 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
56,016 KB
testcase_01 AC 121 ms
55,628 KB
testcase_02 AC 127 ms
55,996 KB
testcase_03 AC 124 ms
55,668 KB
testcase_04 AC 121 ms
55,636 KB
testcase_05 AC 123 ms
55,448 KB
testcase_06 AC 122 ms
56,084 KB
testcase_07 AC 121 ms
55,872 KB
testcase_08 AC 121 ms
55,740 KB
testcase_09 AC 125 ms
55,608 KB
testcase_10 AC 126 ms
55,716 KB
testcase_11 AC 126 ms
55,760 KB
testcase_12 AC 126 ms
55,548 KB
testcase_13 AC 128 ms
56,148 KB
testcase_14 AC 127 ms
55,716 KB
testcase_15 AC 127 ms
56,124 KB
testcase_16 AC 120 ms
55,940 KB
testcase_17 AC 121 ms
56,188 KB
testcase_18 AC 122 ms
55,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No207 {
  public static void main(String[] args) {

    // 標準入力から読み込む際に、Scannerオブジェクトを使う。
    Scanner sc = new Scanner(System.in);

    // int fromを読み込む
    int from = sc.nextInt();

    // int toを読み込む
    int to = sc.nextInt();


    for (int i = from; i <= to; i++) {
      if (String.valueOf(i).contains("3")) { // 3を含む数字か?
        System.out.println(i);
      }else if(i % 3 == 0){  // 3の倍数か?
        System.out.println(i);
      }
    }
  }
}
0