結果
| 問題 |
No.222 引き算と足し算
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2016-12-28 17:18:53 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,089 bytes |
| コンパイル時間 | 822 ms |
| コンパイル使用メモリ | 113,132 KB |
| 実行使用メモリ | 25,700 KB |
| 最終ジャッジ日時 | 2024-12-15 07:55:27 |
| 合計ジャッジ時間 | 2,483 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 RE * 18 |
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
class Magatro
{
static void Main()
{
string S = Console.ReadLine();
T? t=null;
string SS = "";
int a=0, b=0;
for(int i = 0; i < S.Length; i++)
{
if (S[i] == '-')
{
if (i != 0)
{
if (t == null)
{
t = T.minus;
a = int.Parse(SS);
SS = "";
continue;
}
}
}
else if (S[i] == '+')
{
t = T.plus;
a=int.Parse(SS);
SS = "";
continue;
}
SS += S[i];
}
b = int.Parse(SS);
Console.WriteLine(t == T.plus ? a - b : a + b);
}
}
enum T
{
plus,minus
}
mban