結果
問題 |
No.721 Die tertia (ディエ・テルツィア)
|
ユーザー |
![]() |
提出日時 | 2018-09-06 09:14:13 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,036 bytes |
コンパイル時間 | 2,329 ms |
コンパイル使用メモリ | 163,088 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 12:39:06 |
合計ジャッジ時間 | 2,461 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool is_uruu(int year) { if (year % 400 == 0) return true; if (year % 4 == 0 and year % 100 != 0) return true; return false; } string getday(int year, int month, int day) { stringstream ss; ss << year << "/"; ss << setfill('0') << setw(2); ss << month << setw(0); ss << "/"; ss << setfill('0') << setw(2) << day; return ss.str(); } string nextday(string today) { int y = stoi(today.substr(0, 4)); int m = stoi(today.substr(5, 2)); int d = stoi(today.substr(8, 2)); if (m == 2 && (d == 28)) { if (is_uruu(y)) { d++; } else { m++; d = 1; } return getday(y, m, d); } int days[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if (days[m] == d || (m == 2 && d == 29)) { d = 1; m++; if (m == 13) { m = 1; y++; } } else { d++; } return getday(y, m, d); } void hawawa(){ string today; cin >> today; cout << nextday(nextday(today)) << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(0); hawawa(); return 0; }