結果

問題 No.5 数字のブロック
ユーザー ToniTakekawaToniTakekawa
提出日時 2015-07-24 19:18:09
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,356 bytes
コンパイル時間 2,700 ms
コンパイル使用メモリ 104,324 KB
実行使用メモリ 24,336 KB
最終ジャッジ日時 2023-09-22 22:17:21
合計ジャッジ時間 6,417 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
21,876 KB
testcase_01 AC 65 ms
23,832 KB
testcase_02 RE -
testcase_03 AC 76 ms
22,368 KB
testcase_04 WA -
testcase_05 AC 78 ms
22,496 KB
testcase_06 AC 77 ms
22,284 KB
testcase_07 AC 76 ms
22,260 KB
testcase_08 AC 76 ms
22,316 KB
testcase_09 AC 75 ms
22,276 KB
testcase_10 AC 78 ms
22,584 KB
testcase_11 AC 76 ms
24,252 KB
testcase_12 AC 77 ms
22,384 KB
testcase_13 AC 78 ms
22,336 KB
testcase_14 AC 66 ms
23,888 KB
testcase_15 AC 73 ms
22,000 KB
testcase_16 AC 78 ms
22,368 KB
testcase_17 AC 80 ms
22,620 KB
testcase_18 AC 80 ms
22,524 KB
testcase_19 AC 79 ms
22,440 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 76 ms
24,336 KB
testcase_30 AC 76 ms
22,064 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.IO;
using System.Linq;
using System.Text;

// No.5 数字のブロック
// http://yukicoder.me/problems/14
class Program
{
    static void Main(string[] args)
    {
        // var In = new StreamReader("C:\\Users\\tny2\\Desktop\\14-testcase\\test_in\\2.txt");
        var In = Console.In;

        var L = int.Parse(In.ReadLine());
        var N = int.Parse(In.ReadLine());
        var Wn = In.ReadLine()
                        .Split(' ')
                        .Select(w => int.Parse(w))
                        .OrderBy(w => w)
                        .ToArray();

        //--------------------------------------------
        // Nっていつも使わないなあ、と思うのはC#erだけなのだろうか。
        //--------------------------------------------

        // E | W  T | S
        // ----------------
        // 1 | 1  1 | 1
        // 2 | 2  3 | 1 2
        // 3 | 3  6 | 1 2 3
        // 4 | 4 10 | 1 2 3 4

        var E = Enumerable.Range(1, Wn.Count());
        var S = E.Select(e => Wn.Take(e));

        // var V = T.Where(t => t <= L).Count();
        var length = 0;
        var n = 0;
        foreach( var e in E )
        {
            n = e;
            length += Wn[e];
            if (length > L) break;
        }

        Console.WriteLine(n);
    }
}
0