結果

問題 No.405 ローマ数字の腕時計
ユーザー kongarishisyamo
提出日時 2016-08-09 03:31:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 57,144 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 19:02:16
合計ジャッジ時間 1,160 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main(){

	string S;
	int T;

	cin>>S>>T;

	if(S=="I") T+=1;
	else if(S=="II") T+=2;
	else if(S=="III") T+=3;
	else if(S=="IIII") T+=4;
	else if(S=="V") T+=5;
	else if(S=="VI") T+=6;
	else if(S=="VII") T+=7;
	else if(S=="VIII") T+=8;
	else if(S=="IX") T+=9;
	else if(S=="X") T+=10;
	else if(S=="XI") T+=11;
	else if(S=="XII") T+=12;

	while(T<=0||T>=13){
		if(T<=0) T+=12;
		if(T>=13) T-=12;
	}

	if(T==1) cout<<"I"<<endl;
	else if(T==2) cout<<"II"<<endl;
	else if(T==3) cout<<"III"<<endl;
	else if(T==4) cout<<"IIII"<<endl;
	else if(T==5) cout<<"V"<<endl;
	else if(T==6) cout<<"VI"<<endl;
	else if(T==7) cout<<"VII"<<endl;
	else if(T==8) cout<<"VIII"<<endl;
	else if(T==9) cout<<"IX"<<endl;
	else if(T==10) cout<<"X"<<endl;
	else if(T==11) cout<<"XI"<<endl;
	else if(T==12) cout<<"XII"<<endl;

}

0