結果
問題 |
No.207 世界のなんとか
|
ユーザー |
|
提出日時 | 2017-03-07 21:59:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 140 ms / 5,000 ms |
コード長 | 679 bytes |
コンパイル時間 | 3,634 ms |
コンパイル使用メモリ | 75,968 KB |
実行使用メモリ | 54,428 KB |
最終ジャッジ日時 | 2024-06-23 17:59:30 |
合計ジャッジ時間 | 7,035 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class No207 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); List<Integer> nums = new ArrayList<>(); for (int i = a; i <= b; i++) { if (i % 3 == 0) { nums.add(i); } else if (String.valueOf(i).indexOf("3") >= 0) { nums.add(i); } } Collections.sort(nums); for (int n : nums) { System.out.println(n); } sc.close(); } }