結果

問題 No.405 ローマ数字の腕時計
ユーザー TakaTaka
提出日時 2016-09-06 16:52:11
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 749 bytes
コンパイル時間 3,403 ms
コンパイル使用メモリ 74,252 KB
実行使用メモリ 57,928 KB
最終ジャッジ日時 2023-09-21 00:19:26
合計ジャッジ時間 8,086 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,852 KB
testcase_01 AC 126 ms
55,904 KB
testcase_02 AC 125 ms
56,116 KB
testcase_03 AC 126 ms
56,076 KB
testcase_04 AC 123 ms
55,440 KB
testcase_05 AC 126 ms
55,672 KB
testcase_06 AC 127 ms
55,756 KB
testcase_07 AC 125 ms
56,112 KB
testcase_08 AC 127 ms
55,868 KB
testcase_09 AC 125 ms
55,876 KB
testcase_10 AC 125 ms
55,556 KB
testcase_11 AC 126 ms
55,984 KB
testcase_12 AC 125 ms
55,824 KB
testcase_13 AC 124 ms
56,096 KB
testcase_14 AC 125 ms
55,860 KB
testcase_15 AC 129 ms
57,928 KB
testcase_16 AC 123 ms
55,804 KB
testcase_17 AC 126 ms
56,324 KB
testcase_18 AC 129 ms
55,908 KB
testcase_19 AC 127 ms
56,228 KB
testcase_20 AC 126 ms
55,980 KB
testcase_21 AC 128 ms
56,232 KB
testcase_22 AC 124 ms
56,356 KB
testcase_23 AC 126 ms
55,644 KB
testcase_24 AC 125 ms
55,700 KB
testcase_25 AC 125 ms
55,464 KB
testcase_26 AC 123 ms
55,720 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;
					if(S2==0) S2=12;
				}else{
					S2=T+i+1;
					if(S2>12) S2=S2-12;
				}
			}
		}
		
		
		System.out.println(str[S2-1]);
    }
}
0