結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー evawenisevawenis
提出日時 2020-03-19 00:54:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 2,656 ms
コンパイル使用メモリ 203,152 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 20:31:39
合計ジャッジ時間 3,019 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int  yy=0,mm=(s.at(5)-'0')*10+s.at(6)-'0'
		,dd=(s.at(8)-'0')*10+s.at(9)-'0';
	for(int i=0;i<4;++i){
		yy*=10;
		yy+=s.at(i)-'0';
	}
	int n;
	if(mm==2){
		if((yy%4!=0)||(yy%100==0&&yy%400!=0))n=28;
		else n=29;
	}else if((mm<8&&mm%2==1)||(mm>=8&&mm%2==0))n=31;
	else n=30;
	dd+=2;
	if(dd>n){
		dd%=n;
		++mm;
		if(mm>12){
			mm%=12;
			++yy;
		}
	}
	vector<string>v={"/"s,"/0"s};
	int m=0,d=0;
	if(mm<10)++m;
	if(dd<10)++d;
	cout<<yy<<v.at(m)<<mm<<v.at(d)<<dd<<"\n"s;
}
0