結果
問題 | No.1738 What's in the box? |
ユーザー |
![]() |
提出日時 | 2021-11-13 09:18:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 717 bytes |
コンパイル時間 | 3,068 ms |
コンパイル使用メモリ | 105,344 KB |
実行使用メモリ | 19,840 KB |
最終ジャッジ日時 | 2024-11-26 21:50:52 |
合計ジャッジ時間 | 5,032 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 70 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Linq;using System;public class Hello{static void Main(){string[] line = Console.ReadLine().Trim().Split(' ');var n = int.Parse(line[0]);var m = long.Parse(line[1]);line = Console.ReadLine().Trim().Split(' ');var w = Array.ConvertAll(line, long.Parse);getAns(n, m, w);}static void getAns(int n, long m, long[] w){var wsum = w.Sum();if (wsum == 0) { Console.WriteLine(string.Join(" ", Enumerable.Repeat(0, n))); return; }var ans = new long[n];for (int i = 0; i < n; i++){ans[i] = m * w[i] / wsum;}Console.WriteLine(string.Join(" ", ans));}}