結果

問題 No.405 ローマ数字の腕時計
ユーザー shinwisteriashinwisteria
提出日時 2017-04-01 09:37:30
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 3,085 ms
コンパイル使用メモリ 74,412 KB
実行使用メモリ 56,804 KB
最終ジャッジ日時 2023-09-22 01:54:13
合計ジャッジ時間 7,771 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
54,516 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 116 ms
55,952 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 118 ms
56,044 KB
testcase_07 AC 115 ms
56,004 KB
testcase_08 WA -
testcase_09 AC 116 ms
55,684 KB
testcase_10 AC 116 ms
55,768 KB
testcase_11 AC 115 ms
55,948 KB
testcase_12 WA -
testcase_13 AC 116 ms
55,956 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 118 ms
55,720 KB
testcase_17 AC 117 ms
56,252 KB
testcase_18 WA -
testcase_19 AC 116 ms
55,528 KB
testcase_20 AC 116 ms
54,380 KB
testcase_21 AC 118 ms
55,756 KB
testcase_22 AC 116 ms
55,724 KB
testcase_23 AC 117 ms
55,752 KB
testcase_24 AC 117 ms
55,884 KB
testcase_25 AC 118 ms
56,060 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class RomeNumber {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		String S1 = s.next();
		int T = s.nextInt(),now = 0;
		s.close();
		if(S1.contains("V")){
			now += 5;
		}else if(S1.contains("X")){
			now += 10;
		}
		now += (S1.lastIndexOf("I") - S1.indexOf("I") + 1);
		now += T;
		while(now < 0){
			now += 12;
		}
		now %= 12;
		StringBuilder ans = new StringBuilder();
		if(now == 9){
			ans.append("IX");
		}else if(now == 0){
			ans.append("XII");
		}else if(now / 5 == 1){
			ans.append("V");
		}else if(now / 5 == 2){
			ans.append("X");
		}
		if(now != 9 || now != 0){
			for(int i = 0;i < now%5;i++){
				ans.append("I");
			}
		}
		System.out.println(ans);
	}

}
0