結果

問題 No.87 Advent Calendar Problem
ユーザー mobius_bkstmobius_bkst
提出日時 2015-05-03 18:12:39
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,172 bytes
コンパイル時間 4,535 ms
コンパイル使用メモリ 72,964 KB
実行使用メモリ 50,280 KB
最終ジャッジ日時 2023-09-19 05:16:09
合計ジャッジ時間 7,079 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 45 ms
49,656 KB
testcase_03 AC 44 ms
49,092 KB
testcase_04 AC 45 ms
49,168 KB
testcase_05 AC 43 ms
49,308 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 43 ms
49,372 KB
testcase_17 AC 45 ms
49,348 KB
testcase_18 AC 45 ms
49,868 KB
testcase_19 AC 45 ms
49,364 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 45 ms
49,704 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * ツェラーの公式だかってやつで年月日が分かると曜日が分かるやつ
 *
 */
public class No087 {

    private static final int WED = 3;

    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(
                    System.in));
            int y_end = Integer.parseInt(br.readLine());
            int Y;
            int m = 7;
            int d = 23;
            int C;
            int ganma;
            int D = 0;
            int b = (y_end - 2014) / 400;
            long count = b * 57;

            for (int i = 2015 + b * 400; i <= y_end; i++) {
                Y = i % 100;
                C = i / 100;
                ganma = (5 * C) + C / 4;
                D = ((d + ((26 * (m + 1)) / 10 + Y + Y / 4 + ganma + 5)) % 7) + 1;
                if (D == WED) {
                    count++;
                }
            }

            System.out.println(count);
            br.close();
        } catch (Exception e) {

            System.err.println("Error:" + e.getMessage());
        }
    }

}
0