結果
問題 | No.87 Advent Calendar Problem |
ユーザー |
![]() |
提出日時 | 2015-03-16 04:43:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 846 bytes |
コンパイル時間 | 398 ms |
コンパイル使用メモリ | 37,376 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 23:04:33 |
合計ジャッジ時間 | 1,160 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%lld", &N); | ~~~~~^~~~~~~~~~~~
ソースコード
// YukiCoderたんイェイ〜 #include <cstdio> #include <vector> std::vector<int> v{3, 8, 14, 25, 31, 36, 42, 53, 59, 64, 70, 81, 87, 92, 98, 104, 110, 121, 127, 132, 138, 149, 155, 160, 166, 177, 183, 188, 194, 200, 206, 217, 223, 228, 234, 245, 251, 256, 262, 273, 279, 284, 290, 302, 313, 319, 324, 330, 341, 347, 352, 358, 369, 375, 380, 386, 397}; bool isSame[400]; int main(){ long long N; scanf("%lld", &N); for(int i : v){isSame[i] = true;} long long res = 0ll; if(N < 2400){ for(int y=2015;y<=N;y++){ res += isSame[y%400]; } }else{ for(int y=2015;y<2400;y++){ res += isSame[y%400]; } res += (N-2400) / 400 * v.size(); for(N=(N-2400)%400;N>=0;N--){ res += isSame[N%400]; } } printf("%lld\n", res); }