結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー ohreitetsuohreitetsu
提出日時 2018-08-20 22:12:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,193 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 63,444 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-18 08:57:17
合計ジャッジ時間 1,605 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <stdio.h>
using namespace std;
bool uruYear(int y){
	if(y % 4 == 0){
		if(y % 100 == 0){
			if(y % 400 == 0){
				return true;
			}else{
				return false;
			}
		}else{
			return true;
		}
	}else{
		return false;
	}
}
int main(int argc, char* argv[])
{
	int y,m,d;
	scanf("%d/%d/%d",&y,&m,&d);
	d+=2;
	switch(m){
		case 1:
			if (d>31){
				d-=31;
				m=2;
			}
			break;
		case 2:
			if (uruYear(y)){
				if (d>29){
					d-=29;
					m=3;
				}
			}else{
				if (d>28){
					d-=28;
					m=3;
				}
			}
			break;
		case 3:
			if (d>31){
				d-=31;
				m=4;
			}
			break;
		case 4:
			if (d>30){
				d-=30;
				m=5;
			}
			break;
		case 5:
			if (d>31){
				d-=31;
				m=6;
			}
			break;
		case 6:
			if (d>30){
				d-=30;
				m=7;
			}
			break;
		case 7:
			if (d>31){
				d-=31;
				m=8;
			}
			break;
		case 8:
			if (d>31){
				d-=31;
				m=9;
			}
			break;
		case 9:
			if (d>30){
				d-=30;
				m=10;
			}
			break;
		case 10:
			if (d>31){
				d-=31;
				m=11;
			}
			break;
		case 11:
			if (d>30){
				d-=30;
				m=12;
			}
			break;
		case 12:
			if (d>31){
				d-=31;
				m=1;
				y++;
			}
			break;
	}
	printf("%d/%02d/%02d",y,m,d);
	return 0;
}
0