結果
| 問題 |
No.49 算数の宿題
|
| コンテスト | |
| ユーザー |
kekurema
|
| 提出日時 | 2019-03-21 09:40:47 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 5,000 ms |
| コード長 | 749 bytes |
| コンパイル時間 | 2,163 ms |
| コンパイル使用メモリ | 103,680 KB |
| 実行使用メモリ | 17,664 KB |
| 最終ジャッジ日時 | 2024-12-23 02:01:55 |
| 合計ジャッジ時間 | 2,071 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
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.Threading.Tasks;
namespace Code
{
class Program
{
static void Main(string[] args)
{
string line = Console.ReadLine();
line += "e";
int sum = 0;
int num = 0;
char ope = '*';
foreach(var c in line)
{
if (c == '*' || c == '+' || c == 'e') {
if (ope == '*') sum += num;
else sum *= num;
num = 0;
ope = c;
}
else num = num * 10 + int.Parse("" + c);
}
Console.WriteLine(sum);
}
}
}
kekurema