結果

問題 No.207 世界のなんとか
ユーザー Yosuke Yamaguchi
提出日時 2021-01-02 12:06:52
言語 Java
(openjdk 23)
結果
AC  
実行時間 134 ms / 5,000 ms
コード長 605 bytes
コンパイル時間 3,953 ms
コンパイル使用メモリ 79,316 KB
実行使用メモリ 54,140 KB
最終ジャッジ日時 2024-10-12 01:53:55
合計ジャッジ時間 7,662 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.stream.IntStream;

// https://yukicoder.me/problems/no/07
public class WorldWhat207 {
  public static void main(String[] args) {
    // 標準入力から読み込む際に、Scan
    Scanner sc = new Scanner(System.in);

    // String 1つ分を読み込む
    int from = Integer.parseInt(sc.next());
    int to = Integer.parseInt(sc.next());
    IntStream.range(from, to + 1).filter(n -> ((n % 3 == 0) || contains3(n))).forEach(n -> System.out.println(n));
  }

  private static boolean contains3(int n) {
    return Integer.toString(n).contains("3");
  }
}
0