結果

問題 No.207 世界のなんとか
ユーザー YamaKasaYamaKasa
提出日時 2018-04-19 15:55:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 763 bytes
コンパイル時間 2,740 ms
コンパイル使用メモリ 71,060 KB
実行使用メモリ 56,500 KB
最終ジャッジ日時 2023-09-09 11:42:45
合計ジャッジ時間 5,393 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,500 KB
testcase_01 AC 121 ms
56,148 KB
testcase_02 AC 125 ms
56,336 KB
testcase_03 AC 122 ms
55,960 KB
testcase_04 AC 122 ms
56,000 KB
testcase_05 AC 125 ms
56,296 KB
testcase_06 AC 119 ms
55,624 KB
testcase_07 AC 120 ms
55,920 KB
testcase_08 AC 122 ms
54,392 KB
testcase_09 AC 124 ms
55,992 KB
testcase_10 AC 126 ms
56,424 KB
testcase_11 AC 125 ms
55,448 KB
testcase_12 AC 125 ms
55,836 KB
testcase_13 AC 125 ms
55,832 KB
testcase_14 AC 127 ms
56,272 KB
testcase_15 AC 125 ms
56,032 KB
testcase_16 AC 120 ms
55,892 KB
testcase_17 AC 119 ms
55,792 KB
testcase_18 AC 120 ms
55,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		//System.out.println("最小値");
		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		//System.out.println("最大値");
		int B = scanner.nextInt();
		scanner.close();
		int n = B-A + 1;	//調べる数字の数n
		int k = A; //調べる数字
		for(int i=0; i < n; i++) {
			int digits_k = (int)(Math.log10(k))+1;
			if(k % 3 == 0) {
				System.out.println(k);
				k ++;
			}else {
				int k_d1 = k;
				int k_d2 = k/10;
				for(int j=0; j < digits_k; j++) {
					int k_d_j = k_d1 - k_d2*10;
					if(k_d_j == 3) {
						System.out.println(k);
						break;
					}else {
						k_d1 = k_d1/10;
						k_d2 = k_d2/10;
					}

				}
				k++;
			}
		}
	}
}
0