結果

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

ソースコード

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);
        long cnt = n/400*57;
        n %= 400;
        
        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