結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
NetSeed
|
| 提出日時 | 2016-05-10 23:05:35 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 5,000 ms |
| コード長 | 605 bytes |
| コンパイル時間 | 1,575 ms |
| コンパイル使用メモリ | 112,684 KB |
| 実行使用メモリ | 28,112 KB |
| 最終ジャッジ日時 | 2024-11-18 08:35:18 |
| 合計ジャッジ時間 | 3,243 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
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;
}
idx = elem.index;
accum = tmp;
}
Console.WriteLine(idx);
}
}
}
NetSeed