結果

問題 No.188 HAPPY DAY
ユーザー tentententen
提出日時 2020-11-10 17:31:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 1,000 ms
コード長 651 bytes
コンパイル時間 2,007 ms
コンパイル使用メモリ 72,316 KB
実行使用メモリ 55,632 KB
最終ジャッジ日時 2023-09-29 23:41:09
合計ジャッジ時間 2,727 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
    }
}
0