結果

問題 No.405 ローマ数字の腕時計
ユーザー TakaTaka
提出日時 2016-09-06 16:45:09
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 702 bytes
コンパイル時間 3,072 ms
コンパイル使用メモリ 74,460 KB
実行使用メモリ 56,820 KB
最終ジャッジ日時 2023-08-25 18:22:17
合計ジャッジ時間 7,448 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,820 KB
testcase_01 AC 117 ms
56,372 KB
testcase_02 RE -
testcase_03 AC 119 ms
56,252 KB
testcase_04 AC 119 ms
55,732 KB
testcase_05 AC 120 ms
56,464 KB
testcase_06 AC 119 ms
56,372 KB
testcase_07 AC 119 ms
56,404 KB
testcase_08 AC 119 ms
56,088 KB
testcase_09 RE -
testcase_10 AC 119 ms
55,788 KB
testcase_11 RE -
testcase_12 AC 117 ms
56,304 KB
testcase_13 AC 119 ms
56,820 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 117 ms
56,116 KB
testcase_17 AC 118 ms
56,320 KB
testcase_18 AC 117 ms
56,308 KB
testcase_19 AC 119 ms
55,512 KB
testcase_20 RE -
testcase_21 AC 119 ms
56,476 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 AC 118 ms
54,516 KB
testcase_26 AC 118 ms
56,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class a{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		
        String S1 = sc.next();
        int T=sc.nextInt();
		int S2=0;
		int num;
		
		String str[] = new String[12];
		
		str[0]="I"; str[1]="II"; str[2]="III";
		str[3]="IIII"; str[4]="V"; str[5]="VI";
		str[6]="VII"; str[7]="VIII"; str[8]="IX";
		str[9]="X"; str[10]="XI"; str[11]="XII";
		
		for(int i=0; i<12; i++){
			if(S1.equals(str[i])){
				if(T<-12){
					T=(T*(-1)%12)*(-1);
					T=T+12;
				}else if(T<0){
					T=T+12;
				}
				
				if(T>11){
					S2=(T+(i+1))%12;
				}else{
					S2=T+i+1;
				}
			}
		}
		
		
		System.out.println(str[S2-1]);
    }
}
0