結果

問題 No.405 ローマ数字の腕時計
ユーザー btk
提出日時 2016-08-04 10:54:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 1,833 ms
コンパイル使用メモリ 168,796 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-24 04:03:55
合計ジャッジ時間 2,748 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

int convert(string s){
    if(s=="IX")return 9;
    int res=0;
    for(auto &it:s){
        if(it=='I')res++;
        if(it=='V')res+=5;
        if(it=='X')res+=10;
    }
    return (res+11)%12;
}

string convert(int x){
    x++;
    if(x==9)return "IX";
    string res;
    if(x>=10)res+="X",x-=10;
    if(x>=5)res+="V",x-=5;
    while(x--)res+="I";
    return res;
}
int main(){
    string s;int T;
    cin>>s>>T;
    cout<<convert((convert(s)+T%12+12)%12)<<endl;
    return 0;
}
0