結果

問題 No.222 引き算と足し算
ユーザー 明智重蔵明智重蔵
提出日時 2015-09-12 08:17:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 1,000 ms
コード長 1,140 bytes
コンパイル時間 894 ms
コンパイル使用メモリ 112,616 KB
実行使用メモリ 30,732 KB
最終ジャッジ日時 2024-04-27 17:47:37
合計ジャッジ時間 3,446 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
30,352 KB
testcase_01 AC 58 ms
28,716 KB
testcase_02 AC 57 ms
28,232 KB
testcase_03 AC 56 ms
28,432 KB
testcase_04 AC 57 ms
30,536 KB
testcase_05 AC 55 ms
30,724 KB
testcase_06 AC 55 ms
28,336 KB
testcase_07 AC 56 ms
28,592 KB
testcase_08 AC 55 ms
26,292 KB
testcase_09 AC 56 ms
28,256 KB
testcase_10 AC 57 ms
28,464 KB
testcase_11 AC 60 ms
28,512 KB
testcase_12 AC 59 ms
28,608 KB
testcase_13 AC 58 ms
28,336 KB
testcase_14 AC 56 ms
30,648 KB
testcase_15 AC 57 ms
30,732 KB
testcase_16 AC 56 ms
28,592 KB
testcase_17 AC 55 ms
30,396 KB
testcase_18 AC 55 ms
28,384 KB
testcase_19 AC 57 ms
28,768 KB
testcase_20 AC 55 ms
28,252 KB
testcase_21 AC 59 ms
30,472 KB
testcase_22 AC 56 ms
30,524 KB
testcase_23 AC 55 ms
30,344 KB
testcase_24 AC 56 ms
28,384 KB
testcase_25 AC 55 ms
28,512 KB
testcase_26 AC 59 ms
30,444 KB
testcase_27 AC 56 ms
28,488 KB
testcase_28 AC 56 ms
28,132 KB
testcase_29 AC 57 ms
28,432 KB
testcase_30 AC 56 ms
28,644 KB
testcase_31 AC 56 ms
28,508 KB
testcase_32 AC 56 ms
28,720 KB
testcase_33 AC 57 ms
28,356 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.Text.RegularExpressions;

class Program
{
    static string InputPattern = "Input4";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("5+3");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("10-20");
            //30
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("-2+-3");
            //1
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        Match InsMatch = Regex.Match(InputList[0], @"([-+]?[0-9]+)([-+])([-+]?[0-9]+)$");
        int X = int.Parse(InsMatch.Groups[1].Value);
        string Ope = InsMatch.Groups[2].Value;
        int Y = int.Parse(InsMatch.Groups[3].Value);

        if (Ope == "+") Console.WriteLine(X - Y);
        else Console.WriteLine(X + Y);
    }
}
0