結果

問題 No.405 ローマ数字の腕時計
ユーザー PDB_YukariPDB_Yukari
提出日時 2016-08-05 22:47:09
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,376 bytes
コンパイル時間 1,845 ms
コンパイル使用メモリ 104,668 KB
実行使用メモリ 24,912 KB
最終ジャッジ日時 2023-08-25 18:16:48
合計ジャッジ時間 4,362 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
20,568 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 49 ms
22,728 KB
testcase_04 WA -
testcase_05 AC 51 ms
20,704 KB
testcase_06 AC 50 ms
20,580 KB
testcase_07 AC 52 ms
18,740 KB
testcase_08 WA -
testcase_09 AC 52 ms
20,776 KB
testcase_10 AC 51 ms
22,712 KB
testcase_11 AC 53 ms
20,668 KB
testcase_12 AC 53 ms
20,636 KB
testcase_13 AC 54 ms
20,720 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 55 ms
22,964 KB
testcase_17 AC 53 ms
22,720 KB
testcase_18 WA -
testcase_19 AC 53 ms
18,808 KB
testcase_20 AC 54 ms
20,704 KB
testcase_21 AC 52 ms
20,624 KB
testcase_22 AC 53 ms
22,964 KB
testcase_23 AC 54 ms
22,748 KB
testcase_24 AC 54 ms
20,684 KB
testcase_25 AC 55 ms
20,640 KB
testcase_26 AC 54 ms
20,912 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace ATCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string roma = s.Split(' ')[0];
            int t = int.Parse(s.Split(' ')[1]);
            int current = 0;
            foreach (char c in roma)
            {
                if (c == 'X')
                {
                    current += 10;
                }
                else if(c == 'V')
                {
                    current += 5;
                }
                else if(c == 'I')
                {
                    current += 1;
                }
            }
            while (t < 0)
            {
                t += 12;
            }
            int time;
            time = current + t;
            time = time%12;
            string p = "";
            if (time == 0)
            {
                p = "XII";
            }
            else
            {
                for (; time >= 10; time -= 10)
                {
                    p += 'X';
                }
                for (; time >= 5; time -= 5)
                {
                    p += 'V';
                }
                for (; time > 0; time--)
                {
                    p += 'I';
                }
            }
            Console.WriteLine(p);
            Console.ReadLine();
        }
    }
}
0