結果

問題 No.405 ローマ数字の腕時計
コンテスト
ユーザー 大谷祐翔
提出日時 2025-12-01 14:36:31
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 2,184 bytes
コンパイル時間 8,621 ms
コンパイル使用メモリ 170,016 KB
実行使用メモリ 186,752 KB
最終ジャッジ日時 2025-12-01 14:36:43
合計ジャッジ時間 10,816 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (113 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #
raw source code

class Program
{
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine()!.Split(' ');
        string time = input[0];
        int num = int.Parse(input[1]);

        int startTime = NumChangeFunc(time);
        int endTime = (startTime + num) % 12;

        while (endTime < 0)
        {
            endTime += 12;
        }

        Console.WriteLine(StrChangeFunc(endTime));
    }

    public static string StrChangeFunc(int time)
    {
        if (time == 1)
        {
            return "I";
        }
        else if (time == 2)
        {
            return "II";
        }
        else if (time == 3)
        {
            return "III";
        }
        else if (time == 4)
        {
            return "IIII";
        }
        else if (time == 5)
        {
            return "V";
        }
        else if (time == 6)
        {
            return "VI";
        }
        else if (time == 7)
        {
            return "VII";
        }
        else if (time == 8)
        {
            return "VIII";
        }
        else if (time == 9)
        {
            return "IX";
        }
        else if (time == 10)
        {
            return "X";
        }
        else if (time == 11)
        {
            return "XI";
        }
        return "XII";
    }

    public static int NumChangeFunc(string time)
    {
        if (time == "I")
        {
            return 1;
        }
        else if (time == "II")
        {
            return 2;
        }
        else if (time == "III")
        {
            return 3;
        }
        else if (time == "IIII")
        {
            return 4;
        }
        else if (time == "V")
        {
            return 5;
        }
        else if (time == "VI")
        {
            return 6;
        }
        else if (time == "VII")
        {
            return 7;
        }
        else if (time == "VIII")
        {
            return 8;
        }
        else if (time == "IX")
        {
            return 9;
        }
        else if (time == "X")
        {
            return 10;
        }
        else if (time == "XI")
        {
            return 11;
        }
        return 12;
    }
}
0