結果
| 問題 |
No.721 Die tertia (ディエ・テルツィア)
|
| ユーザー |
stone_725
|
| 提出日時 | 2018-09-06 09:13:13 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,013 bytes |
| コンパイル時間 | 1,840 ms |
| コンパイル使用メモリ | 162,836 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-30 12:38:55 |
| 合計ジャッジ時間 | 2,660 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 3 |
ソースコード
#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) {
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;
}
stone_725