結果
問題 | No.87 Advent Calendar Problem |
ユーザー |
![]() |
提出日時 | 2015-07-07 09:41:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,001 bytes |
コンパイル時間 | 702 ms |
コンパイル使用メモリ | 84,880 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-08 01:29:28 |
合計ジャッジ時間 | 1,822 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:54:12: warning: ‘ppp’ may be used uninitialized in this function [-Wmaybe-uninitialized] 54 | LL ans = (N-2014)/(400*7) * same + ppp; | ^~~
ソースコード
#define _USE_MATH_DEFINES #include <iostream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <list> #include <queue> #include <vector> #include <complex> #include <set> ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)<<endl; ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(6);// LL day0 = 2014/4 - 2014/100 + 2014/400; LL N; cin>>N; LL plus = 0; LL pp = (N-2014)%(400*7); LL ppp; //plus = (N/4 - N/100 + N/400 - day0) + N-2014; LL same=0; for(LL i = 2014; i < 2014+400*7; ++i){ if(plus%7==0){ ++same; } if(2014+pp == i){ ppp = same; } // ++plus; if((i+1)%4==0 && ((i+1)%400==0 || (i+1)%100 != 0) ){ ++plus; } } LL ans = (N-2014)/(400*7) * same + ppp; P(ans-1); return 0; }