結果

問題 No.2492 Knapsack Problem?
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-06 21:26:34
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 1,819 ms
コンパイル使用メモリ 67,992 KB
実行使用メモリ 23,952 KB
最終ジャッジ日時 2023-10-06 21:26:37
合計ジャッジ時間 2,885 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,908 KB
testcase_01 AC 61 ms
21,844 KB
testcase_02 AC 61 ms
23,952 KB
testcase_03 AC 60 ms
21,952 KB
testcase_04 AC 61 ms
21,956 KB
testcase_05 AC 60 ms
19,928 KB
testcase_06 AC 61 ms
21,996 KB
testcase_07 AC 61 ms
22,008 KB
testcase_08 AC 61 ms
21,968 KB
testcase_09 AC 61 ms
21,856 KB
testcase_10 AC 62 ms
21,948 KB
testcase_11 AC 63 ms
23,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, w) = (c[0], c[1]);
        var ans = -1;
        for (var i = 0; i < n; ++i)
        {
            c = NList;
            if (c[1] <= w) ans = Math.Max(ans, c[0]);
        }
        WriteLine(ans);
    }
}
0