結果

問題 No.617 Nafmo、買い出しに行く
ユーザー mencottonmencotton
提出日時 2018-01-20 23:03:21
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 747 bytes
コンパイル時間 2,283 ms
コンパイル使用メモリ 104,808 KB
実行使用メモリ 24,076 KB
最終ジャッジ日時 2023-08-26 09:28:03
合計ジャッジ時間 7,363 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
21,840 KB
testcase_01 AC 87 ms
21,952 KB
testcase_02 AC 154 ms
21,892 KB
testcase_03 AC 198 ms
21,976 KB
testcase_04 AC 111 ms
19,796 KB
testcase_05 AC 209 ms
22,208 KB
testcase_06 AC 232 ms
21,792 KB
testcase_07 AC 230 ms
21,864 KB
testcase_08 AC 70 ms
21,856 KB
testcase_09 AC 78 ms
21,844 KB
testcase_10 AC 239 ms
21,992 KB
testcase_11 AC 239 ms
22,068 KB
testcase_12 AC 236 ms
22,464 KB
testcase_13 AC 234 ms
24,024 KB
testcase_14 AC 238 ms
22,144 KB
testcase_15 AC 233 ms
24,076 KB
testcase_16 AC 230 ms
22,080 KB
testcase_17 AC 231 ms
23,724 KB
testcase_18 AC 70 ms
21,848 KB
testcase_19 AC 70 ms
23,836 KB
testcase_20 AC 79 ms
21,980 KB
testcase_21 AC 95 ms
23,880 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _617
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            bool[] dp = new bool[5000000]; dp[0] = true;
            for (int i = 0; i < x[0]; i++)
            {
                int a = int.Parse(Console.ReadLine());
                for (int j = 4999999; j >= 0; j--)
                {
                    if (dp[j]) dp[j + a] = true;
                }
            }
            int ret = 0;
            for (int i = 0; i <= x[1]; i++) if (dp[i]) ret = i;
            Console.WriteLine(ret);
        }
    }
}
0