結果

問題 No.207 世界のなんとか
ユーザー h_tyokinuhatah_tyokinuhata
提出日時 2015-12-23 01:49:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 540 bytes
コンパイル時間 2,252 ms
コンパイル使用メモリ 75,880 KB
実行使用メモリ 41,456 KB
最終ジャッジ日時 2024-04-17 16:32:42
合計ジャッジ時間 5,081 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
40,860 KB
testcase_01 AC 126 ms
41,088 KB
testcase_02 AC 123 ms
40,936 KB
testcase_03 AC 128 ms
41,048 KB
testcase_04 AC 122 ms
41,188 KB
testcase_05 AC 118 ms
40,136 KB
testcase_06 AC 117 ms
41,340 KB
testcase_07 AC 119 ms
41,064 KB
testcase_08 AC 123 ms
40,820 KB
testcase_09 AC 117 ms
41,088 KB
testcase_10 AC 118 ms
41,456 KB
testcase_11 AC 128 ms
40,176 KB
testcase_12 AC 129 ms
41,324 KB
testcase_13 AC 120 ms
40,928 KB
testcase_14 AC 128 ms
41,064 KB
testcase_15 AC 112 ms
39,928 KB
testcase_16 AC 107 ms
39,908 KB
testcase_17 AC 121 ms
41,344 KB
testcase_18 AC 117 ms
41,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 
class Main {
    public static void main(String[] args) {
    	
    	Scanner sc = new Scanner(System.in);
    	ArrayList<Integer> thList = new ArrayList<>();

    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	int cnt = 0;
    	for(int i = A; i <= B; i++) {
    		if(i % 3 == 0) {
    			thList.add(i);
    			cnt++;
    		} else if(String.valueOf(i).contains("3")) {
    			thList.add(i);
    			cnt++;
    		}
    	}
    	for(int i = 0; i < cnt; i++) {
    		System.out.println(thList.get(i));
    	}
    }
}
0