結果

問題 No.1046 Fruits Rush
ユーザー curryudon08curryudon08
提出日時 2020-06-06 22:24:11
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 468 bytes
コンパイル時間 2,114 ms
コンパイル使用メモリ 103,616 KB
実行使用メモリ 23,856 KB
最終ジャッジ日時 2023-08-25 02:06:25
合計ジャッジ時間 4,035 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,816 KB
testcase_01 AC 64 ms
23,796 KB
testcase_02 AC 65 ms
23,800 KB
testcase_03 AC 67 ms
23,788 KB
testcase_04 AC 67 ms
21,648 KB
testcase_05 AC 65 ms
21,788 KB
testcase_06 AC 65 ms
21,816 KB
testcase_07 AC 66 ms
23,756 KB
testcase_08 AC 65 ms
21,676 KB
testcase_09 AC 67 ms
21,700 KB
testcase_10 AC 66 ms
23,728 KB
testcase_11 AC 66 ms
21,744 KB
testcase_12 AC 65 ms
19,692 KB
testcase_13 AC 65 ms
21,628 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

namespace _1046
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = int.Parse(_[0]);
            var k = int.Parse(_[1]);

            var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            var s = a.Where(x => x >= 0).OrderByDescending(x => x).Take(k).Sum();

            Console.WriteLine(s);
        }
    }
}
0