結果
| 問題 |
No.405 ローマ数字の腕時計
|
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2015-11-03 22:02:35 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 2,000 ms |
| コード長 | 966 bytes |
| コンパイル時間 | 2,165 ms |
| コンパイル使用メモリ | 103,936 KB |
| 実行使用メモリ | 18,048 KB |
| 最終ジャッジ日時 | 2024-07-06 18:55:45 |
| 合計ジャッジ時間 | 4,139 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yuki
{
class Program
{
static void Main(string[] args)
{
//入力・宣言
string[] s = Console.ReadLine().Split();
string r = s[0];
int a = 0;
int t = int.Parse(s[1]);
string[] rome = { "XII", "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI" };
//ローマ数字をアラビア数字に変換
for (int i = 0; i < rome.Length; i++)
{
if (rome[i].Equals(r)) a = i;
}
//計算
a = a + t;
if ((a >= 12) || (a <= -12)) a = a % 12;
if (a < 0) a = 12 + a;
//アラビア数字をローマ数字に変換
r = rome[a];
//出力
Console.WriteLine(r);
}
}
}
No