結果

問題 No.405 ローマ数字の腕時計
ユーザー samplelpmas
提出日時 2017-01-09 19:37:12
言語 Java
(openjdk 23)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 1,832 ms
コンパイル使用メモリ 74,296 KB
実行使用メモリ 54,364 KB
最終ジャッジ日時 2024-07-06 19:08:35
合計ジャッジ時間 5,971 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        final String[] romanNumerals = {"XII", "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI"};

        String currentTimeRoman = sc.next();

        int currentTime = 0;

        for (int i = 0; i < romanNumerals.length; i++) {

            if (currentTimeRoman.equals(romanNumerals[i])) {
                currentTime = i;
            }

        }

        int timeLater = currentTime + sc.nextInt();

        timeLater = (timeLater % 12 + 12) % 12;

        System.out.println(romanNumerals[timeLater]);

    }

}
0