結果
問題 | No.188 HAPPY DAY |
ユーザー |
![]() |
提出日時 | 2020-07-25 17:00:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,023 bytes |
コンパイル時間 | 746 ms |
コンパイル使用メモリ | 92,492 KB |
実行使用メモリ | 6,816 KB |
最終ジャッジ日時 | 2024-06-27 09:42:00 |
合計ジャッジ時間 | 1,066 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>#include <cmath>#include <iomanip>#include <stack>#include <algorithm>#include <string>#include <map>#include <iterator>#include <set>#include <queue>using namespace std;int lastDayOfMonth(int year, int month) {int day[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};if (year % 400 == 0) {day[1] = 29;} else if (year % 100 == 0) {day[1] = 28;} else if (year % 4 == 0) {day[1] = 29;} else {day[1] = 28;}return day[month - 1];}int daySum(int day) {if (day >= 10) {return day / 10 + day % 10;} else {return day;}}int main() {int count = 0;for (int month = 1; month <= 12; ++month) {int lastDay = lastDayOfMonth(2015, month);for (int day = 1; day <= lastDay; ++day) {if (month == daySum(day)) {count += 1;}}}cout << count << endl;return 0;}