結果
問題 |
No.721 Die tertia (ディエ・テルツィア)
|
ユーザー |
![]() |
提出日時 | 2019-05-30 21:56:16 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 738 bytes |
コンパイル時間 | 1,273 ms |
コンパイル使用メモリ | 160,556 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 16:09:49 |
合計ジャッジ時間 | 1,773 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include "bits/stdc++.h" using namespace std; int main() { int Y, M, D, X[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; char C; cin >> Y >> C >> M >> C >> D; if (M == 2 && D == 27) { if ((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) cout << Y << "/02/29" << endl; else cout << Y << "/03/01" << endl; } else if (M == 2 && D == 28) { if ((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) cout << Y << "/03/01" << endl; else cout << Y << "/03/02" << endl; } else { D += 2; if (D > X[M]) { D -= X[M]; M++; } if (M > 12) { M = M % 12; Y++; } cout << Y << "/" << std::setfill('0') << std::right << std::setw(2) << M << "/" << std::setfill('0') << std::right << std::setw(2) << D << endl; } }