結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー evawenis
提出日時 2020-03-19 00:54:36
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 197,496 KB
最終ジャッジ日時 2025-01-09 07:48:05
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

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