結果
問題 | No.207 世界のなんとか |
ユーザー |
![]() |
提出日時 | 2020-11-11 08:24:27 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 122 ms / 5,000 ms |
コード長 | 691 bytes |
コンパイル時間 | 4,771 ms |
コンパイル使用メモリ | 74,852 KB |
実行使用メモリ | 41,640 KB |
最終ジャッジ日時 | 2024-07-22 18:18:23 |
合計ジャッジ時間 | 6,272 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import java.util.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int a = sc.nextInt();int b = sc.nextInt();StringBuilder sb = new StringBuilder();for (int i = a; i <= b; i++) {if (isMatch(i)) {sb.append(i).append("\n");}}System.out.print(sb);}static boolean isMatch(int x) {int sum = 0;while (x > 0) {int mod = x % 10;if (mod == 3) {return true;}sum += mod;x /= 10;}return (sum % 3 == 0);}}