結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー hotaka0213hotaka0213
提出日時 2019-05-15 17:52:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 828 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 61,580 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 06:09:22
合計ジャッジ時間 1,736 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <ios>
#include <iomanip>
using namespace std;
int main(){
	int YY,MM,DD;
	char dd;
	cin>>YY>>dd>>MM>>dd>>DD;
	DD+=2;
	switch(MM){
		case 2:{
			if(YY%4==0){
				if(YY%100!=0){
					if(DD>29){
						DD-=29;
						MM++;
					}
				}else{
					if(YY%400==0){
						if(DD>29){
							DD-=29;
							MM++;
						}
					}else{
						if(DD>28){
							DD-=28;
							MM++;
						}
					}
				}
			}else{
				if(DD>28){
					DD-=28;
					MM++;
				}
			}
			break;
	       }
		case 4:
		case 6:
		case 9:
		case 11:{
			if(DD>30){
				DD-=30;
				MM++;
			}
			break;
		}
		case 12:{
			if(DD>31){
				DD-=31;
				MM-=11;
				YY++;
			}
			break;
		}
		default:{
			if(DD>31){
				DD-=31;
				MM++;
			}
		}
	}
	cout<<setfill('0')<<right<<setw(4)<<YY<<"/"<<setw(2)<<MM<<"/"<<setw(2)<<DD<<endl;
	return 0;
}
0