結果

問題 No.405 ローマ数字の腕時計
ユーザー PDB_Yukari
提出日時 2016-08-05 22:43:16
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,202 bytes
コンパイル時間 844 ms
コンパイル使用メモリ 110,968 KB
実行使用メモリ 26,200 KB
最終ジャッジ日時 2024-12-24 04:06:07
合計ジャッジ時間 2,498 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
            }
            current = current % 12;
            int time;
            time = current + t;
            time = time%12;
            string p = "";
            for (;time>= 10; time -=10)
            {
                p += 'X';
            }
            for (; time >= 5; time -=5)
            {
                p += 'V';
            }
            for (; time > 0 ; time--)
            {
                p += 'I';
            }
            Console.WriteLine(p);
        }
    }
}
0