結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー KuraKura
提出日時 2019-02-24 22:08:31
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 783 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 51,124 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 14:39:29
合計ジャッジ時間 4,056 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:7: warning: ‘x’ is used uninitialized in this function [-Wuninitialized]
  scanf("%d/%d/%d", x, y, z);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:5:7: warning: ‘y’ is used uninitialized in this function [-Wuninitialized]
main.cpp:5:7: warning: ‘z’ is used uninitialized in this function [-Wuninitialized]

ソースコード

diff #

#include<iostream>
using namespace std;
int main() {
	int x, y, z;
	scanf("%d/%d/%d", x, y, z);
	if (y != 2) {
		if (y == 4 || y == 6 || y == 9 || y == 11) {
			z += 2;
			if (z > 30) {
				z -= 30;
				y += 1;
			}
		}
		else {
			z += 2;
			if (z > 31) {
				z -= 31;
				y += 1;
				if (y == 13) {
					y = 1;
					x += 1;
				}
			}
		}
	}
	else {
		if (x % 4 == 0) {
			z += 2;
			if (x % 100 == 0 && x % 400 != 0) {
				if (z > 28) {
					z -= 28;
					y++;
				}
			}
			else {
				if (z > 29) {
					z -= 29;
					y++;
				}
			}
		}
		else {
			z += 2;
			if (z > 28) {
				z -= 28;
				y++;
			}
		}
	}
	cout << x << '/';
	if (y < 10) {
		cout << 0 << y << '/';
	}
	else {
		cout << y << '/';
	}
	if (z < 10) {
		cout << 0 << z << endl;
	}
	else {
		cout << z << endl;
	}
}
0