結果

問題 No.207 世界のなんとか
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-23 01:33:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 547 bytes
コンパイル時間 3,440 ms
コンパイル使用メモリ 74,416 KB
実行使用メモリ 41,616 KB
最終ジャッジ日時 2024-04-20 00:59:42
合計ジャッジ時間 5,867 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
41,532 KB
testcase_01 AC 126 ms
41,228 KB
testcase_02 AC 129 ms
41,412 KB
testcase_03 AC 122 ms
39,832 KB
testcase_04 AC 106 ms
41,368 KB
testcase_05 AC 111 ms
41,420 KB
testcase_06 AC 115 ms
41,012 KB
testcase_07 AC 121 ms
41,228 KB
testcase_08 AC 106 ms
40,956 KB
testcase_09 AC 125 ms
41,376 KB
testcase_10 AC 122 ms
40,048 KB
testcase_11 AC 119 ms
41,616 KB
testcase_12 AC 119 ms
41,064 KB
testcase_13 AC 107 ms
41,252 KB
testcase_14 AC 112 ms
41,020 KB
testcase_15 AC 123 ms
41,532 KB
testcase_16 AC 105 ms
41,232 KB
testcase_17 AC 104 ms
41,340 KB
testcase_18 AC 109 ms
41,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Exercises4{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int firstNum = sc.nextInt();
    int secondNum = sc.nextInt();

    for(int n = firstNum; n <= secondNum; n++){
      if (n % 3 == 0 || isThreeExist(n)){
        System.out.println(n);
      }
    }
  }
  private static boolean isThreeExist(int a){
    char[] array = String.valueOf(a).toCharArray();
    for(char ca: array){
      if(ca == '3'){
        return true;
      }
    }
    return false;
  }
}
0