結果

問題 No.87 Advent Calendar Problem
ユーザー itezpaceitezpace
提出日時 2016-08-02 09:10:51
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 777 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 54,492 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 15:06:37
合計ジャッジ時間 1,207 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,248 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 WA -
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
5,376 KB
testcase_25 WA -
testcase_26 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin>>n;
  ll a,b,c,d,e,f,g,x,y,z;
  a=0;
  c=n-2015+1;
  f=0;
  if(c>=2800){
    c%=2800;
    f=1;
  }
  x=0;
  y=0;
  for(int i=2015; i<2015+c; ++i){
    d=365;
    if(i%4==0){
      if(i%100==0){
        if(i%400==0){
          d=366;
        }
      } else {
        d=366;
      }
    }
    x+=d%7;
    if(x==0) y++;
    else if(x%7==0) y++;
  }
  if(f==1){
    b=(n-2015+1)/2800;
    e=x;
    g=0;
    for(int i=1; i<=2800; ++i){
      d=365;
      if(i%4==0){
        if(i%100==0){
          if(i%400==0){
            d=366;
          }
        } else {
          d=366;
        }
      }
      e+=d%7;
      if(e%7==0) g++;
    }
    a=b*g;
  }
  z=y+a;
  cout<<z<<endl;
  return 0;
}
0