結果
問題 | No.87 Advent Calendar Problem |
ユーザー |
|
提出日時 | 2019-07-21 05:10:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 303 bytes |
コンパイル時間 | 787 ms |
コンパイル使用メモリ | 60,672 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-02 21:50:41 |
合計ジャッジ時間 | 2,018 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream>using namespace std;bool is(int N){return N%400==0||N%100!=0&&N%4==0;}int cnt[401];main(){long N;cin>>N;int now=0;for(int i=2015;i<2415;i++){now+=365+is(i);cnt[i-2014]=cnt[i-2015]+(now%7==0);}long ans=(N-2014)/400*cnt[400];cout<<ans+cnt[(N-2014)%400]<<endl;}