結果

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

ソースコード

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