結果
| 問題 |
No.87 Advent Calendar Problem
|
| コンテスト | |
| ユーザー |
dnish
|
| 提出日時 | 2017-05-04 13:41:30 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 506 bytes |
| コンパイル時間 | 1,623 ms |
| コンパイル使用メモリ | 167,708 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-14 07:05:20 |
| 合計ジャッジ時間 | 2,620 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
int main(){
ll N;
cin >> N;
ll day = 0;
ll after = N - 2014;
ll ans = 0;
ll mul = after/2800;
ans += mul * 399;
after %= 2800;
REP(i,0,after){
int y = 2015 + i;
if (y % 400 == 0) day += 366;
else if (y % 100 == 0) day += 365;
else if (y % 4 == 0) day += 366;
else day += 365;
if (day % 7 == 0) ans ++;
}
cout << ans << endl;
return 0;
}
dnish