結果

問題 No.405 ローマ数字の腕時計
ユーザー kohaku_kohaku
提出日時 2016-11-13 20:14:02
言語 Java
(openjdk 23)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 2,294 ms
コンパイル使用メモリ 74,440 KB
実行使用メモリ 54,296 KB
最終ジャッジ日時 2024-07-06 19:07:43
合計ジャッジ時間 6,090 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int T = sc.nextInt();
        String [] arr = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"};
        int now = 0;
        for(int i=0; i<12; i++){
            if( S.equals(arr[i]) ){
                now=i;
            }
        }
        T=T%12;
        if(T<0){
            T=T+12;
        }
        now=now+T;
        while(now>11){
            now=now-12;
        }
        System.out.println(arr[now]);
    }
}
0