結果

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

ソースコード

diff #

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

int main() {
map<string,int> m={{"I",1},{"II",2},{"III",3},{"IIII",4},{"V",5},{"VI",6},{"VII",7},{"VIII",8},{"IX",9},{"X",10},{"XI",11},{"XII",12}};
map<int,string> mm={{1,"I"},{2,"II"},{3,"III"},{4,"IIII"},{5,"V"},{6,"VI"},{7,"VII"},{8,"VIII"},{9,"IX"},{10,"X"},{11,"XI"},{12,"XII"}};
string s;
cin>>s;
int k,l;
cin>>k;

l=(m[s]+k)%12;
if(l==0){
	cout<<"XII"<<endl;
}else if(l>=0){
cout<<mm[l]<<endl;
}else{
cout<<mm[12+l]<<endl;
}

}

0