結果

問題 No.405 ローマ数字の腕時計
ユーザー Taka
提出日時 2016-09-06 16:49:03
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 724 bytes
コンパイル時間 3,796 ms
コンパイル使用メモリ 77,804 KB
実行使用メモリ 42,888 KB
最終ジャッジ日時 2024-12-24 04:13:29
合計ジャッジ時間 8,789 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 RE * 8
権限があれば一括ダウンロードができます

ソースコード

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;
				}
			}
		}
		
		
		System.out.println(str[S2-1]);
    }
}
0