結果
問題 | No.188 HAPPY DAY |
ユーザー |
|
提出日時 | 2020-08-30 16:11:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 816 bytes |
コンパイル時間 | 1,756 ms |
コンパイル使用メモリ | 167,536 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-15 10:52:15 |
合計ジャッジ時間 | 2,175 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ui = unsigned;// 月末日数リストconst vector<ui> lastdays({0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31});// 閏年対策用(2015年限定なら不要)ui leap(ui yyyy) {if (yyyy % 400 == 0) {return 1;} else if (yyyy % 100 == 0) {return 0;} else if (yyyy % 4 == 0) {return 1;} else {return 0;}}// 指定年の日付を1年分ループint main() {ui yyyy = 2015;ui lastday;ui ans = 0;for (ui mm = 1; mm <= 12; ++mm) {lastday = lastdays[mm] + (mm == 2 ? leap(yyyy) : 0);for (ui dd = 1; dd <= lastday; ++dd) {if (mm == dd / 10 + dd % 10) {ans++;}}}cout << ans << endl;getchar();}// 入力無し// 日付確認用// cout << i << "/" << j << endl;