結果
| 問題 |
No.617 Nafmo、買い出しに行く
|
| コンテスト | |
| ユーザー |
mencotton
|
| 提出日時 | 2018-01-20 23:03:21 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 215 ms / 2,000 ms |
| コード長 | 747 bytes |
| コンパイル時間 | 3,559 ms |
| コンパイル使用メモリ | 113,952 KB |
| 実行使用メモリ | 27,316 KB |
| 最終ジャッジ日時 | 2024-12-25 03:52:22 |
| 合計ジャッジ時間 | 5,354 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 20 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);
}
}
}
mencotton