結果

問題 No.1738 What's in the box?
ユーザー bluemegane
提出日時 2021-11-13 09:14:19
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 620 bytes
コンパイル時間 2,891 ms
コンパイル使用メモリ 112,292 KB
実行使用メモリ 26,596 KB
最終ジャッジ日時 2024-11-26 21:37:37
合計ジャッジ時間 4,332 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 68 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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();
        var ans = new long[n];
        for (int i = 0; i < n; i++)
        {
            ans[i] = m * w[i] / wsum;
        }
        Console.WriteLine(string.Join(" ", ans));
    }
}
0