結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー 東前頭十一枚目東前頭十一枚目
提出日時 2020-03-13 13:35:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 1,608 ms
コンパイル使用メモリ 167,904 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-01 18:28:31
合計ジャッジ時間 2,515 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

bool LeapYear(int64_t n) {
	if(n % 400== 0) return true;
	if(n % 100== 0) return false;
	if(n % 4 == 0) return true;
	return false;
}

void tomorrow(int& y, int& m, int& d) {
	const int day[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	++d;
	if(d > day[m]) {
		if((not LeapYear(y)) or (not (m == 2))) {
			d = 1;
			m = (m + 1) % 13 + 1;
		}
	}
	if(m == 1 and d == 1) {
		y++;
	}
}

int main() {
	int y, m, d; char _;
	cin >> y >> _ >> m >> _ >> d;
	tomorrow(y, m, d);
	tomorrow(y, m, d);
	printf("%04d/%02d/%02d\n", y, m, d);
	return 0;
}

0