結果
| 問題 |
No.207 世界のなんとか
|
| コンテスト | |
| ユーザー |
Gchansanjou
|
| 提出日時 | 2018-02-11 14:47:43 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 58 ms / 5,000 ms |
| コード長 | 1,353 bytes |
| コンパイル時間 | 3,696 ms |
| コンパイル使用メモリ | 77,312 KB |
| 実行使用メモリ | 48,280 KB |
| 最終ジャッジ日時 | 2024-11-16 10:21:20 |
| 合計ジャッジ時間 | 5,153 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
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;
}
}
Gchansanjou