結果
問題 | No.87 Advent Calendar Problem |
ユーザー |
![]() |
提出日時 | 2019-04-19 14:48:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 5,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 2,506 ms |
コンパイル使用メモリ | 192,920 KB |
最終ジャッジ日時 | 2025-01-07 02:29:13 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include<bits/stdc++.h>using namespace std;using Int = long long;template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}//INSERT ABOVE HEREsigned main(){Int n;cin>>n;n-=2014;auto is_uruu=[](Int x){if(x%400==0) return 1;if(x%100==0) return 0;if(x%4==0) return 1;return 0;};auto calc=[&](Int z){Int res=0;for(Int i=0;i<=z;i++)res+=365+is_uruu(2015+i);return res%7==0;};Int x=n/2800;Int y=n%2800;Int z=0;for(Int i=0;i<2800;i++) z+=calc(i);Int ans=x*z;for(Int i=0;i<y;i++) ans+=calc(i);cout<<ans<<endl;return 0;}