結果

問題 No.87 Advent Calendar Problem
ユーザー sugim48sugim48
提出日時 2014-12-07 00:43:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,272 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 75,456 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-02 09:08:50
合計ジャッジ時間 3,408 ms
ジャッジサーバーID
(参考情報)
judge14 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-9;

bool is_uruu(ll y) {
	if (y % 400 == 0) return true;
	if (y % 100 == 0) return false;
	if (y % 4 == 0) return true;
	return false;
}

int main() {
	int Y = 0, X = 0, K = 0;
	for (;;) {
		if (Y > 0 && Y % 400 == 0 && X == 0) break;
		if (X == 0) K++;
		X += is_uruu(Y + 1) ? 2 : 1;
		X %= 7;
		Y++;
	}
	Y *= 10000; K *= 10000;
	ll N; cin >> N;
	int x = 0; ll k = 0;
	for (ll y = 2014; y <= N;) {
		if (y % 400 == 0 && y + Y <= N) {
			k += K;
			y += Y;
		}
		else {
			if (x == 0) k++;
			x += is_uruu(y + 1) ? 2 : 1;
			x %= 7;
			y++;
		}
	}
	cout << k - 1 << endl;
}
0