結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
21,796 KB
testcase_01 AC 64 ms
21,668 KB
testcase_02 WA -
testcase_03 AC 75 ms
22,260 KB
testcase_04 AC 74 ms
22,164 KB
testcase_05 AC 76 ms
22,384 KB
testcase_06 AC 74 ms
22,252 KB
testcase_07 AC 74 ms
22,236 KB
testcase_08 AC 75 ms
22,316 KB
testcase_09 AC 73 ms
22,060 KB
testcase_10 AC 77 ms
22,416 KB
testcase_11 AC 74 ms
22,252 KB
testcase_12 AC 76 ms
20,244 KB
testcase_13 AC 78 ms
24,372 KB
testcase_14 AC 65 ms
21,840 KB
testcase_15 AC 71 ms
21,884 KB
testcase_16 AC 77 ms
22,480 KB
testcase_17 AC 78 ms
24,456 KB
testcase_18 AC 78 ms
22,376 KB
testcase_19 AC 79 ms
24,496 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 65 ms
21,788 KB
testcase_24 AC 73 ms
23,844 KB
testcase_25 AC 71 ms
21,840 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 74 ms
22,372 KB
testcase_30 AC 73 ms
21,964 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.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\\4.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(0, 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