結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-01-24 10:36:30 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 5,000 ms |
| コード長 | 547 bytes |
| 記録 | |
| コンパイル時間 | 2,634 ms |
| コンパイル使用メモリ | 106,752 KB |
| 実行使用メモリ | 20,992 KB |
| 最終ジャッジ日時 | 2026-05-12 22:48:37 |
| 合計ジャッジ時間 | 2,765 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Linq;
class Program
{
static void Main(string[] args)
{
int box = int.Parse(Console.ReadLine());
int block = int.Parse(Console.ReadLine());
int[] array = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
int sum = 0;
int i = 0;
Array.Sort(array);
for (; i < block; i++)
{
sum += array[i];
if (sum > box)
{
break;
}
}
Console.WriteLine(i);
}
}