結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
aketijyuuzou
|
| 提出日時 | 2026-11-01 14:56:16 |
| 言語 | C# (.NET 10.0.403 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 43 ms / 5,000 ms |
| + 558µs | |
| コード長 | 1,495 bytes |
| 記録 | |
| コンパイル時間 | 7,619 ms |
| コンパイル使用メモリ | 171,540 KB |
| 実行使用メモリ | 33,664 KB |
| 最終ジャッジ日時 | 2026-11-01 14:56:28 |
| 合計ジャッジ時間 | 10,404 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (214 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net10.0/main.dll main -> /home/judge/data/code/bin/Release/net10.0/publish/
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{
static string InputPattern = "InputX";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("2*3");
//5
//太郎君の国では、記号'*'は足し算を表します。
//2と3を足して5が解になります
}
else if (InputPattern == "Input2") {
WillReturn.Add("6*7+2");
//26
//我々の世界の表記に直すと 6+7×2ですが、
//優先度が無いため6と7を足してから2を掛けます
}
else if (InputPattern == "Input3") {
WillReturn.Add("2497*3+4");
//10000
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
static void Main()
{
List<string> InputList = GetInputList();
string S = InputList[0];
var ValArr = S.Split('+', '*').Select(X => BigInteger.Parse(X)).ToArray();
int AppearOpeCnt = 0;
var Answer = ValArr[0];
foreach (char EachChar in S) {
if (EachChar == '+') Answer *= ValArr[++AppearOpeCnt];
if (EachChar == '*') Answer += ValArr[++AppearOpeCnt];
}
Console.WriteLine(Answer);
}
}
aketijyuuzou