結果
問題 |
No.405 ローマ数字の腕時計
|
ユーザー |
![]() |
提出日時 | 2017-12-12 20:29:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 809 bytes |
コンパイル時間 | 678 ms |
コンパイル使用メモリ | 85,004 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 19:15:03 |
合計ジャッジ時間 | 1,407 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
#include <iostream> #include <stdio.h> #include <algorithm> #include <vector> #include <cmath> #include <string> #include <sstream> #include<sstream> #include <queue> #include <limits> #include <cstdlib> #include <deque> #include <map> #include <set> #include <iomanip> using namespace std; int main() { string roma[13] ; roma[0] = ""; roma[1] ="I"; roma[2] ="II"; roma[3] ="III"; roma[4] ="IIII"; roma[5] ="V"; roma[6] ="VI"; roma[7] ="VII"; roma[8] ="VIII"; roma[9] = "IX"; roma[10] = "X"; roma[11] = "XI"; roma[12] ="XII"; string st ; int n=0; cin>>st>>n; int ans =0; for(int i=1; i<13; i++){ if(roma[i] == st){ ans = i+n%12; } } if(ans >12){ cout<<roma[ans-12]<<endl; }else if(ans <=0){ cout<<roma[ans+12]<<endl; }else { cout<<roma[ans]<<endl; } return 0; }