結果
| 問題 |
No.222 引き算と足し算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-06-06 01:16:29 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 1,000 ms |
| コード長 | 1,100 bytes |
| コンパイル時間 | 854 ms |
| コンパイル使用メモリ | 113,864 KB |
| 実行使用メモリ | 30,672 KB |
| 最終ジャッジ日時 | 2024-11-15 21:30:10 |
| 合計ジャッジ時間 | 4,053 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / 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.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Application
{
class MainClass
{
public static void Main(string[] args)
{
new MainClass().Calc();
}
public MainClass() { }
public void Calc()
{
var r = Console.ReadLine();
var m = Regex.Match(r, "^([-+]?[0-9]+)([-+])([-+]?[0-9]+)");
var A = int.Parse(m.Groups[1].Value);
var op = m.Groups[2].Value;
var B = int.Parse(m.Groups[3].Value);
if (op == "+")
Console.WriteLine(A - B);
else
Console.WriteLine(A + B);
}
void WriteLine(object o)
{
System.Console.WriteLine(o.ToString());
}
void WriteEnum<T>(IEnumerable<T> l)
{
WriteLine(JoinList(l));
}
string JoinList<T>(IEnumerable<T> l)
{
return string.Join(" ", l.Select(x => x.ToString()).ToArray());
}
}
}