結果
問題 | No.222 引き算と足し算 |
ユーザー |
![]() |
提出日時 | 2016-05-31 23:49:44 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 22 ms / 1,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 745 ms |
コンパイル使用メモリ | 103,168 KB |
実行使用メモリ | 17,792 KB |
最終ジャッジ日時 | 2024-11-15 22:12:03 |
合計ジャッジ時間 | 2,393 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; namespace No222{ public class Program{ public static void Main(string[] args){ var input = Console.ReadLine(); var split = 0; for(var i = 1; i < input.Length; i++){ if(!char.IsDigit(input[i])){ split = i; break; } } var x = int.Parse(input.Substring(0, split)); var op = input[split]; var y = int.Parse(input.Substring(split + 1)); if(op == '+') Console.WriteLine(x - y); if(op == '-') Console.WriteLine(x + y); } } }