結果

問題 No.87 Advent Calendar Problem
ユーザー t8m8⛄️
提出日時 2015-04-09 14:13:11
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,137 bytes
コンパイル時間 3,672 ms
コンパイル使用メモリ 78,656 KB
実行使用メモリ 45,636 KB
最終ジャッジ日時 2024-07-04 13:24:53
合計ジャッジ時間 47,365 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

//No.87 Advent Calendar Problem

import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.lang.Math.*;

public class No87 {
    
    static final Scanner in = new Scanner(System.in);
    static final PrintWriter out = new PrintWriter(System.out,false);

    static void solve() {
        long n = in.nextLong()-2014;
        Calendar c = Calendar.getInstance();
        c.set(2014,7,23);
        int w = c.get(Calendar.DAY_OF_WEEK);
        int cnt = 0;
        while (n - 400 >= 0) {
            n -= 400;
            c.add(Calendar.DAY_OF_YEAR,400);
            cnt += 57;
        }
        for (int i=0; i<=n; i++) {
            c.add(Calendar.DAY_OF_YEAR,1);
            if (w == c.get(Calendar.DAY_OF_WEEK)) cnt++;
        }
        out.println(cnt);
    }

    public static void main(String[] args) {
        long start = System.currentTimeMillis();

        solve();
        out.flush();

        long end = System.currentTimeMillis();
        //trace(end-start + "ms");
        in.close();
        out.close();
    }

    static void trace(Object... o) { System.out.println(deepToString(o));}
}
0