結果

問題 No.188 HAPPY DAY
ユーザー airisairis
提出日時 2015-05-13 23:59:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,097 bytes
コンパイル時間 883 ms
コンパイル使用メモリ 72,932 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-29 02:07:19
合計ジャッジ時間 947 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <numeric>
#include <bitset>
#define rep(x, to) for (int x = 0; x < (to); x++)
#define REP(x, a, to) for (int x = (a); x < (to); x++)
#define foreach(itr, x) for (typeof((x).begin()) itr = (x).begin(); itr != (x).end(); itr++)

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;

int days [] = {
	31, // 1
	28, // 2
	31, // 3
	30, // 4
	31, // 5
	30, // 6 
	31, // 7
	31, // 8
	30, // 9
	31, // 10
	30, // 11
	31, // 12
};

bool is_leap(int year) {
	if (year % 400) return true;
	if (year % 4 == 0 && year != 100) return true;
	return false;
}

int check(int m, int d) {
	return m == d%10 + d/10;
}

int ans;

int main() {
	int year = 2015;
	days[2-1] += (int)is_leap(2015);
	rep(i, 12) {
		rep(j, days[i]) {
			int month = i + 1;
			int day = j + 1;
			ans += check(month, day);
		}
	}
	cout << ans << endl;
	return 0;
}


0