結果

問題 No.222 引き算と足し算
ユーザー bluemeganebluemegane
提出日時 2018-09-29 17:03:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 644 bytes
コンパイル時間 995 ms
コンパイル使用メモリ 112,536 KB
実行使用メモリ 27,716 KB
最終ジャッジ日時 2024-04-20 12:53:43
合計ジャッジ時間 2,906 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
21,816 KB
testcase_01 AC 25 ms
23,732 KB
testcase_02 AC 24 ms
23,524 KB
testcase_03 AC 25 ms
25,568 KB
testcase_04 AC 24 ms
23,516 KB
testcase_05 AC 24 ms
23,760 KB
testcase_06 AC 24 ms
27,716 KB
testcase_07 AC 25 ms
23,644 KB
testcase_08 AC 24 ms
23,852 KB
testcase_09 AC 24 ms
23,768 KB
testcase_10 AC 24 ms
23,392 KB
testcase_11 AC 25 ms
23,648 KB
testcase_12 AC 24 ms
25,680 KB
testcase_13 AC 24 ms
23,652 KB
testcase_14 AC 24 ms
23,504 KB
testcase_15 AC 24 ms
23,636 KB
testcase_16 AC 24 ms
23,776 KB
testcase_17 AC 25 ms
25,564 KB
testcase_18 AC 26 ms
25,424 KB
testcase_19 AC 25 ms
23,780 KB
testcase_20 AC 24 ms
21,936 KB
testcase_21 AC 24 ms
23,852 KB
testcase_22 AC 25 ms
21,816 KB
testcase_23 AC 24 ms
25,680 KB
testcase_24 AC 26 ms
23,644 KB
testcase_25 AC 24 ms
23,728 KB
testcase_26 AC 26 ms
23,392 KB
testcase_27 AC 25 ms
25,560 KB
testcase_28 AC 25 ms
25,556 KB
testcase_29 AC 24 ms
23,772 KB
testcase_30 AC 25 ms
23,648 KB
testcase_31 AC 24 ms
23,756 KB
testcase_32 AC 26 ms
23,652 KB
testcase_33 AC 26 ms
23,628 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var b = getOP(s);
        var a0 = int.Parse(s.Substring(0, b));
        var a1 = int.Parse(s.Substring(b + 1));
        Console.WriteLine(s[b] == '+' ? a0 - a1: a0 + a1);
    }
    public static int getOP (string s )
    {
        var numbegin = false;
        for (int i = 0; i < s.Length; i++)
        {
            if (isNUM(s[i]) && !numbegin  ) numbegin = true;
            if (!isNUM(s[i]) && numbegin) return i;
        }
        return 0;
    }
    public static bool isNUM (char c) => c != '+'  &&  c != '-';
}
0