結果
問題 | No.188 HAPPY DAY |
ユーザー |
![]() |
提出日時 | 2020-11-10 17:31:28 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 90 ms / 1,000 ms |
コード長 | 651 bytes |
コンパイル時間 | 2,164 ms |
コンパイル使用メモリ | 74,044 KB |
実行使用メモリ | 39,776 KB |
最終ジャッジ日時 | 2024-07-22 17:36:35 |
合計ジャッジ時間 | 2,466 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 |
ソースコード
import java.util.*;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);int[] days = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int count = 0;for (int i = 0; i < days.length; i++) {for (int k = 1; k <= days[i]; k++) {if (i + 1 == getNum(k)) {count++;}}}System.out.println(count);}static int getNum(int x) {int ans = 0;while (x > 0) {ans += x % 10;x /= 10;}return ans;}}