結果

問題 No.207 世界のなんとか
ユーザー mits58mits58
提出日時 2016-05-05 14:33:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 500 bytes
コンパイル時間 1,639 ms
コンパイル使用メモリ 74,892 KB
実行使用メモリ 54,268 KB
最終ジャッジ日時 2024-04-17 16:45:15
合計ジャッジ時間 4,284 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
54,088 KB
testcase_01 AC 105 ms
54,148 KB
testcase_02 AC 113 ms
53,948 KB
testcase_03 AC 112 ms
53,884 KB
testcase_04 AC 107 ms
54,076 KB
testcase_05 AC 105 ms
54,064 KB
testcase_06 AC 96 ms
53,008 KB
testcase_07 AC 104 ms
53,964 KB
testcase_08 AC 107 ms
54,104 KB
testcase_09 AC 99 ms
53,056 KB
testcase_10 AC 109 ms
52,804 KB
testcase_11 AC 98 ms
52,692 KB
testcase_12 AC 109 ms
54,268 KB
testcase_13 AC 100 ms
52,928 KB
testcase_14 AC 110 ms
53,992 KB
testcase_15 AC 115 ms
53,944 KB
testcase_16 AC 103 ms
54,024 KB
testcase_17 AC 104 ms
53,984 KB
testcase_18 AC 101 ms
52,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	static boolean f(long x){
		if(x%3==0) return true;
		else{
			String str=Long.toString(x);
			for(int i=0;i<str.length();i++){
				if(str.charAt(i)=='3') return true;
			}
			return false;
		}
	}
	public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
        	long a=sc.nextLong();
        	long b=sc.nextLong();
        	for(long i=a;i<=b;i++) if(f(i)) System.out.println(i);
        }
    }
}
0