結果
問題 | No.721 Die tertia (ディエ・テルツィア) |
ユーザー |
|
提出日時 | 2022-01-12 01:52:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 783 bytes |
コンパイル時間 | 1,902 ms |
コンパイル使用メモリ | 169,956 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 12:44:21 |
合計ジャッジ時間 | 2,836 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int year = stoi(s.substr(0, 4)); int month = stoi(s.substr(5, 2)); int day = stoi(s.substr(8, 2)); bool leap = false; if(year % 4 == 0) { if(year % 100 == 0) { if(year % 400 == 0) { leap = true; } } else leap = true; } vector<int> days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if(leap) days[1]++; day += 2; if(day > days[month-1]) { day -= days[month-1]; month++; } if(month == 13) { month = 1; year++; } cout << year << '/' << setw(2) << setfill('0') << month << '/' << setw(2) << setfill('0') << day << '\n'; return 0; }