結果

問題 No.222 引き算と足し算
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-08-28 17:01:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 1,000 ms
コード長 1,208 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 104,764 KB
実行使用メモリ 22,856 KB
最終ジャッジ日時 2023-08-28 17:01:43
合計ジャッジ時間 5,505 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
20,784 KB
testcase_01 AC 56 ms
20,672 KB
testcase_02 AC 53 ms
22,760 KB
testcase_03 AC 53 ms
20,720 KB
testcase_04 AC 52 ms
20,776 KB
testcase_05 AC 51 ms
22,660 KB
testcase_06 AC 52 ms
20,728 KB
testcase_07 AC 52 ms
20,684 KB
testcase_08 AC 52 ms
20,724 KB
testcase_09 AC 52 ms
18,596 KB
testcase_10 AC 50 ms
20,664 KB
testcase_11 AC 52 ms
20,728 KB
testcase_12 AC 52 ms
22,700 KB
testcase_13 AC 53 ms
22,640 KB
testcase_14 AC 52 ms
20,760 KB
testcase_15 AC 52 ms
20,640 KB
testcase_16 AC 52 ms
22,652 KB
testcase_17 AC 52 ms
20,776 KB
testcase_18 AC 54 ms
20,756 KB
testcase_19 AC 52 ms
20,720 KB
testcase_20 AC 53 ms
22,856 KB
testcase_21 AC 52 ms
22,660 KB
testcase_22 AC 51 ms
20,664 KB
testcase_23 AC 52 ms
22,768 KB
testcase_24 AC 52 ms
20,776 KB
testcase_25 AC 53 ms
20,656 KB
testcase_26 AC 53 ms
22,668 KB
testcase_27 AC 52 ms
20,700 KB
testcase_28 AC 52 ms
22,664 KB
testcase_29 AC 52 ms
22,676 KB
testcase_30 AC 52 ms
20,708 KB
testcase_31 AC 52 ms
20,760 KB
testcase_32 AC 51 ms
20,716 KB
testcase_33 AC 53 ms
20,728 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.Numerics;

namespace yukicoder
{
    public class Program
    {
        public static void Main()
        {
            var x = Console.ReadLine();
            var c = false;
            var d = false;
            var f = new string[3];
            for(var i = 0; i < x.Length; i++)
            {
                var k = x[i] - '0';
                if (k >= 0 && k <= 9)
                {
                    c = true;
                }
                if (c && (x[i] == '+' || x[i] == '-') && !d)
                {
                    f[1] += x[i];
                    d = true;
                }
                else if (!d)
                {
                    f[0] += x[i];
                }
                else
                {
                    f[2] += x[i];
                }
            }
            switch (f[1])
            {
                case "+":
                    Console.WriteLine(int.Parse(f[0]) - int.Parse(f[2]));
                    break;
                case "-":
                    Console.WriteLine(int.Parse(f[0]) + int.Parse(f[2]));
                    break;
            }
        }
    }
}
0