結果
| 問題 | No.87 Advent Calendar Problem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-07-21 05:10:16 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 303 bytes |
| 記録 | |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 74,608 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-06 07:57:15 |
| 合計ジャッジ時間 | 1,818 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}