結果

問題 No.188 HAPPY DAY
ユーザー hotpepsihotpepsi
提出日時 2015-09-07 00:08:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 468 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 51,032 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-29 03:04:01
合計ジャッジ時間 1,006 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <ctime>

using namespace std;

int main(int argc, char *argv[]) {
	tm t = {};
	t.tm_year = 2015 - 1900;
	t.tm_mday = 1;
	time_t a = mktime(&t);
	int cnt = 0;
	while (true) {
		tm *b = localtime(&a);
		if (b->tm_year > t.tm_year) {
			break;
		}
		int mon = b->tm_mon + 1;
		int day = b->tm_mday;
		int c = 0;
		while (day) {
			c += day % 10;
			day /= 10;
		}
		cnt += mon == c;
		a += 24 * 60 * 60;
	}
	cout << cnt << endl;
	return 0;
}
0