結果
問題 |
No.222 引き算と足し算
|
ユーザー |
![]() |
提出日時 | 2016-12-28 17:20:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 23 ms / 1,000 ms |
コード長 | 1,266 bytes |
コンパイル時間 | 1,008 ms |
コンパイル使用メモリ | 113,564 KB |
実行使用メモリ | 19,772 KB |
最終ジャッジ日時 | 2024-12-15 07:55:30 |
合計ジャッジ時間 | 2,596 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
コンパイルメッセージ
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] == '+') { if (i != 0) { if (t == null) { 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 }