結果

問題 No.207 世界のなんとか
ユーザー CecilCecil
提出日時 2022-12-20 11:33:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 706 bytes
コンパイル時間 2,125 ms
コンパイル使用メモリ 74,580 KB
実行使用メモリ 41,420 KB
最終ジャッジ日時 2024-04-29 02:44:00
合計ジャッジ時間 4,842 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
41,152 KB
testcase_01 AC 119 ms
41,280 KB
testcase_02 AC 127 ms
41,232 KB
testcase_03 AC 110 ms
41,412 KB
testcase_04 AC 118 ms
39,872 KB
testcase_05 AC 106 ms
41,020 KB
testcase_06 AC 116 ms
41,420 KB
testcase_07 AC 106 ms
41,292 KB
testcase_08 AC 111 ms
40,892 KB
testcase_09 AC 121 ms
41,284 KB
testcase_10 AC 112 ms
40,228 KB
testcase_11 AC 121 ms
41,024 KB
testcase_12 AC 115 ms
41,356 KB
testcase_13 AC 109 ms
40,988 KB
testcase_14 AC 123 ms
41,132 KB
testcase_15 AC 118 ms
41,340 KB
testcase_16 AC 119 ms
41,392 KB
testcase_17 AC 109 ms
41,004 KB
testcase_18 AC 125 ms
40,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

		int a = scan.hasNextInt() ? scan.nextInt() : -1;
		int b = scan.hasNextInt() ? scan.nextInt() : -1;
		if (a > 2000000000 || a < 1 || b > 2000000000 || b < 1) {
			System.out.println("入力エラー1");
			return;
		}
		int count = b - a;
		if (count > 99 || count < 0 ) {
			System.out.println("入力エラー2");
			return;
		}
		
		for(int i = a; i <= b; i++){
		    if(i >= 3){
    		    if(Integer.toString(i).contains("3")){
    		         System.out.println(i);
	    	    }
		        else if(i % 3 == 0){
		            System.out.println(i);
		        }
		    }
		}

	}
}
0