結果
| 問題 |
No.987 N×Mマス計算(基本)
|
| ユーザー |
|
| 提出日時 | 2023-04-26 05:43:13 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 106 ms / 2,000 ms |
| コード長 | 1,212 bytes |
| コンパイル時間 | 16,695 ms |
| コンパイル使用メモリ | 172,308 KB |
| 実行使用メモリ | 188,320 KB |
| 最終ジャッジ日時 | 2024-11-15 14:16:40 |
| 合計ジャッジ時間 | 10,146 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (118 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
delegate long MyDelegate(long a, long b);
static long Add(long x, long y)
{
return x + y;
}
static long Multiply(long x, long y)
{
return x * y;
}
static void Main(string[] args)
{
MyDelegate calc;
var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
var N = input[0];
var M = input[1];
var row = Console.ReadLine().Split();
var op = row[0];
if (op == "+") calc = Add;
else calc = Multiply;
var num = new List<long>();
for (int i = 0; i < N; i++)
{
num.Add(long.Parse(Console.ReadLine()));
}
var num2 = new List<long>();
for (int i = 1; i < row.Length; i++)
{
num2.Add(long.Parse(row[i]));
}
for (int i = 0; i < N; i++)
{
for (int j = 0; j < M; j++)
{
var result = calc(num[i], num2[j]);
Console.Write(result);
if (j != M - 1) Console.Write(" ");
}
Console.WriteLine();
}
}
}