結果
| 問題 |
No.222 引き算と足し算
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2016-12-28 17:09:24 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 993 bytes |
| コンパイル時間 | 2,365 ms |
| コンパイル使用メモリ | 110,068 KB |
| 実行使用メモリ | 18,048 KB |
| 最終ジャッジ日時 | 2024-12-15 07:52:51 |
| 合計ジャッジ時間 | 3,110 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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();
S = S.Replace("--", "+");
S = S.Replace("+-", "-");
int[] a = new int[2];
int c = 0;
string SS = "";
for(int i =0; i<S.Length; i++)
{
if (S[i] == '+')
{
a[c] = int.Parse(SS);
c++;
SS = "";
continue;
}
else if(S[i]=='-')
{
if (SS != "")
{
a[c] = int.Parse(SS);
c++;
SS = "";
}
}
SS += S[i];
}
a[1] = -int.Parse(SS);
Console.WriteLine(a[1] + a[0]);
}
}
enum T
{
plus,minus
}
mban