結果
問題 |
No.207 世界のなんとか
|
ユーザー |
![]() |
提出日時 | 2018-02-11 14:41:16 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,353 bytes |
コンパイル時間 | 3,473 ms |
コンパイル使用メモリ | 76,720 KB |
実行使用メモリ | 37,124 KB |
最終ジャッジ日時 | 2024-11-16 08:43:44 |
合計ジャッジ時間 | 5,661 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 10 |
ソースコード
package yukiCoder; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00207 { public static void main(String[] args) { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String[] input = new String[2]; try { input = bufferedReader.readLine().split(" "); int start = Integer.parseInt(input[0]); int end = Integer.parseInt(input[1]); calculation(start,end); } catch (IOException e) { e.printStackTrace(); } } public static void calculation(int start, int end) { if (start >= end) { return; } for (; start < end ; start++) { if (isMultipleOfThree(start) || isDigitIncludingThree(start)) { System.out.println(start); } } } public static Boolean isMultipleOfThree(int input) { int fullDigitAns = 0; String check = String.valueOf(input); for (int i = 0 ; i < check.length() ; i++) { int digit = Integer.parseInt(String.valueOf(check.charAt(i))); fullDigitAns += digit; } return fullDigitAns%3 == 0 ? true : false; } public static Boolean isDigitIncludingThree(int input) { String check = String.valueOf(input); for (int i = 0 ; i < check.length() ; i++) { int digit = Integer.parseInt(String.valueOf(check.charAt(i))); if (digit == 3) return true; } return false; } }