結果

問題 No.222 引き算と足し算
ユーザー Masahiro HayashiMasahiro Hayashi
提出日時 2015-06-06 01:16:29
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 1,000 ms
コード長 1,100 bytes
コンパイル時間 897 ms
コンパイル使用メモリ 114,240 KB
実行使用メモリ 30,812 KB
最終ジャッジ日時 2024-04-27 17:26:10
合計ジャッジ時間 3,536 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
30,420 KB
testcase_01 AC 56 ms
28,716 KB
testcase_02 AC 55 ms
28,500 KB
testcase_03 AC 55 ms
28,632 KB
testcase_04 AC 58 ms
28,760 KB
testcase_05 AC 59 ms
28,368 KB
testcase_06 AC 59 ms
27,988 KB
testcase_07 AC 58 ms
28,500 KB
testcase_08 AC 58 ms
30,296 KB
testcase_09 AC 57 ms
30,676 KB
testcase_10 AC 60 ms
30,668 KB
testcase_11 AC 57 ms
28,760 KB
testcase_12 AC 60 ms
28,592 KB
testcase_13 AC 58 ms
28,248 KB
testcase_14 AC 58 ms
28,760 KB
testcase_15 AC 58 ms
30,676 KB
testcase_16 AC 55 ms
28,716 KB
testcase_17 AC 55 ms
28,512 KB
testcase_18 AC 57 ms
28,504 KB
testcase_19 AC 57 ms
28,756 KB
testcase_20 AC 58 ms
30,812 KB
testcase_21 AC 57 ms
28,496 KB
testcase_22 AC 56 ms
28,504 KB
testcase_23 AC 55 ms
28,636 KB
testcase_24 AC 58 ms
30,552 KB
testcase_25 AC 59 ms
28,724 KB
testcase_26 AC 57 ms
28,596 KB
testcase_27 AC 55 ms
28,464 KB
testcase_28 AC 64 ms
28,500 KB
testcase_29 AC 60 ms
28,632 KB
testcase_30 AC 58 ms
27,992 KB
testcase_31 AC 56 ms
28,504 KB
testcase_32 AC 56 ms
28,500 KB
testcase_33 AC 57 ms
30,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace Application
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            new MainClass().Calc();
        }

        public MainClass() { }

        public void Calc()
        {
            var r = Console.ReadLine();

            var m = Regex.Match(r, "^([-+]?[0-9]+)([-+])([-+]?[0-9]+)");

            var A = int.Parse(m.Groups[1].Value);
            var op = m.Groups[2].Value;
            var B = int.Parse(m.Groups[3].Value);

            if (op == "+")
                Console.WriteLine(A - B);
            else
                Console.WriteLine(A + B);
        }

        void WriteLine(object o)
        {
            System.Console.WriteLine(o.ToString());
        }

        void WriteEnum<T>(IEnumerable<T> l)
        {
            WriteLine(JoinList(l));
        }

        string JoinList<T>(IEnumerable<T> l)
        {
            return string.Join(" ", l.Select(x => x.ToString()).ToArray());
        }
    }

}
0