結果
問題 |
No.721 Die tertia (ディエ・テルツィア)
|
ユーザー |
|
提出日時 | 2019-08-10 12:22:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 1,520 ms |
コンパイル使用メモリ | 166,840 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 17:05:48 |
合計ジャッジ時間 | 2,421 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool isLeap(int n) { return n % 4 == 0 && !(n % 100 == 0 && n % 400 != 0); } int main() { int a[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int y, m, d; char c; cin >> y >> c >> m >> c >> d; if (isLeap(y)) a[2] = 29; d += 2; if (d > a[m]) { d -= a[m]; m++; if (m > 12) { y++; m = 1; } } cout << y << "/" << setfill('0') << setw(2) << m << "/" << setfill('0') << setw(2) << d << endl; }