結果

問題 No.188 HAPPY DAY
ユーザー bal4ubal4u
提出日時 2019-04-13 10:48:07
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 607 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 29,492 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-02 04:37:55
合計ジャッジ時間 572 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

// yukicoder: No.188 HAPPY DAY
// 2019.4.13 bal4u

#include <stdio.h>

int daysOfMonth(int year, int month)
{
	static int days[12] = {
		31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

	if (month < 1 || month > 12) month = 1;

	if (month == 2) return days[1] +
		(year % 4 == 0 && year % 100 != 0 || year % 400 == 0);
	else return days[month - 1];
}

int s[35];

int main()
{
	int i, m, d, ans;

	for (i = 1; i <= 31; i++) s[i] = (i % 10) + (i / 10);
	ans = 0;
	for (m = 1; m <= 12; m++) {
		d = daysOfMonth(2015, m);
		for (i = 1; i <= d; i++) if (s[i] == m) ans++;
	}
	printf("%d\n", ans);
	return 0;
}
0