結果

問題 No.87 Advent Calendar Problem
ユーザー imulanimulan
提出日時 2016-01-22 17:54:00
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,057 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 73,468 KB
実行使用メモリ 7,692 KB
最終ジャッジ日時 2023-10-21 13:46:03
合計ジャッジ時間 13,316 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <climits>
using namespace std;

typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)

bool uru(ll y){
  bool ret;

  if(y%4==0){
    if(y%100==0){
      if(y%400==0) ret=true;
      else ret=false;
    }
    else ret=true;
  }
  else ret=false;

  return ret;
}
int main(int argc, char const *argv[]) {
  ll y;
  cin >>y;

  int n=3;
  ll ans=0;
  ll before=2014;

  for(ll i=2015; i<=y; ++i){
    if(uru) n+=2;
    else n+=1;
    n%=7;

    if(n==3){
      ++ans;
      //cout << " " << i << endl;
      if(i-before!=7){
        cout<<"not 7:"<<before<<" , "<<i<<endl;
      }
      before=i;
    }
  }

  cout << ans << endl;
  return 0;
}
0