結果

問題 No.5 数字のブロック
ユーザー NetSeedNetSeed
提出日時 2016-05-10 23:02:54
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 583 bytes
コンパイル時間 1,047 ms
コンパイル使用メモリ 112,072 KB
実行使用メモリ 29,580 KB
最終ジャッジ日時 2024-04-15 15:07:58
合計ジャッジ時間 3,397 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
19,200 KB
testcase_01 AC 34 ms
19,328 KB
testcase_02 WA -
testcase_03 AC 41 ms
20,352 KB
testcase_04 AC 41 ms
20,352 KB
testcase_05 AC 43 ms
20,224 KB
testcase_06 AC 40 ms
20,224 KB
testcase_07 AC 40 ms
20,096 KB
testcase_08 AC 41 ms
20,224 KB
testcase_09 AC 39 ms
20,224 KB
testcase_10 AC 43 ms
20,608 KB
testcase_11 AC 40 ms
20,352 KB
testcase_12 AC 41 ms
20,352 KB
testcase_13 AC 42 ms
20,352 KB
testcase_14 AC 35 ms
19,456 KB
testcase_15 AC 38 ms
20,096 KB
testcase_16 AC 44 ms
20,352 KB
testcase_17 AC 44 ms
20,480 KB
testcase_18 AC 45 ms
20,608 KB
testcase_19 AC 45 ms
20,736 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 34 ms
19,456 KB
testcase_24 AC 39 ms
19,840 KB
testcase_25 AC 40 ms
20,096 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 40 ms
20,224 KB
testcase_30 AC 39 ms
19,840 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 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 TestBench
{

	internal class Program
	{
		internal static void Main()
		{
			var l = int.Parse(Console.ReadLine());
			Console.ReadLine();
			var w =
				Console.ReadLine()
					.Split(' ')
					.Select(x => short.Parse(x))
					.OrderBy(x => x)
					.Select((size, index) => new {index = index + 1, size});

			var accum = 0;
			var idx = 0;

			foreach (var elem in w)
			{
				var tmp = accum + elem.size;

				if (tmp > l)
				{
					idx = elem.index - 1;
					break;
				}

				accum = tmp;
			}

			Console.WriteLine(idx);

		}
	}
}
0