結果
| 問題 | No.87 Advent Calendar Problem | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-08-02 09:10:51 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 777 bytes | 
| コンパイル時間 | 498 ms | 
| コンパイル使用メモリ | 54,904 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-06 23:35:30 | 
| 合計ジャッジ時間 | 1,422 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 12 WA * 12 | 
ソースコード
#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;
}
            
            
            
        