結果

問題 No.405 ローマ数字の腕時計
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 20:14:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 2,439 ms
コンパイル使用メモリ 71,492 KB
実行使用メモリ 56,336 KB
最終ジャッジ日時 2023-09-21 00:22:54
合計ジャッジ時間 6,137 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,740 KB
testcase_01 AC 119 ms
56,124 KB
testcase_02 AC 118 ms
55,924 KB
testcase_03 AC 118 ms
55,740 KB
testcase_04 AC 118 ms
55,804 KB
testcase_05 AC 119 ms
56,308 KB
testcase_06 AC 118 ms
55,844 KB
testcase_07 AC 121 ms
56,200 KB
testcase_08 AC 118 ms
55,816 KB
testcase_09 AC 117 ms
55,692 KB
testcase_10 AC 118 ms
55,728 KB
testcase_11 AC 117 ms
55,904 KB
testcase_12 AC 117 ms
55,992 KB
testcase_13 AC 117 ms
54,216 KB
testcase_14 AC 120 ms
55,636 KB
testcase_15 AC 120 ms
55,640 KB
testcase_16 AC 121 ms
55,928 KB
testcase_17 AC 120 ms
55,720 KB
testcase_18 AC 119 ms
56,336 KB
testcase_19 AC 120 ms
56,036 KB
testcase_20 AC 117 ms
56,308 KB
testcase_21 AC 119 ms
56,264 KB
testcase_22 AC 118 ms
54,232 KB
testcase_23 AC 121 ms
56,084 KB
testcase_24 AC 119 ms
56,052 KB
testcase_25 AC 118 ms
56,180 KB
testcase_26 AC 117 ms
55,952 KB
権限があれば一括ダウンロードができます

ソースコード

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