結果

問題 No.188 HAPPY DAY
ユーザー airis
提出日時 2015-05-13 23:59:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,097 bytes
コンパイル時間 862 ms
コンパイル使用メモリ 77,212 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 20:18:13
合計ジャッジ時間 1,455 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

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