結果
| 問題 |
No.721 Die tertia (ディエ・テルツィア)
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2018-08-04 18:01:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,184 bytes |
| コンパイル時間 | 707 ms |
| コンパイル使用メモリ | 86,288 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-19 17:53:25 |
| 合計ジャッジ時間 | 1,362 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 721.cc: No.721 Die tertia (ディエ・テルツィア) - yukicoder
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
using namespace std;
/* constant */
const int doms[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
/* typedef */
/* global variables */
int readnum(string &s, int i, int l) {
int num = 0;
while (l--) num = num * 10 + s[i++] - '0';
return num;
}
/* subroutines */
inline bool leap(int y) {
return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
inline int dom(int y, int m) {
return (leap(y) && m == 2) ? 29 : doms[m];
}
/* main */
int main() {
string ymd;
cin >> ymd;
int y = readnum(ymd, 0, 4);
int m = readnum(ymd, 5, 2);
int d = readnum(ymd, 8, 2);
//printf("%d/%d/%d\n", y, m, d);
int dm = dom(y, m);
d += 2;
if (d > dm) m++, d -= dm;
if (m > 12) m = 1, y++;
printf("%04d/%02d/%02d\n", y, m, d);
return 0;
}
tnakao0123