結果

問題 No.5 数字のブロック
ユーザー fujicfujic
提出日時 2017-12-25 21:52:59
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 75 ms / 5,000 ms
コード長 852 bytes
コンパイル時間 2,150 ms
コンパイル使用メモリ 104,580 KB
実行使用メモリ 24,316 KB
最終ジャッジ日時 2023-08-11 17:59:27
合計ジャッジ時間 5,720 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,772 KB
testcase_01 AC 62 ms
21,780 KB
testcase_02 AC 61 ms
23,696 KB
testcase_03 AC 73 ms
22,304 KB
testcase_04 AC 73 ms
22,208 KB
testcase_05 AC 74 ms
22,280 KB
testcase_06 AC 74 ms
22,164 KB
testcase_07 AC 71 ms
22,292 KB
testcase_08 AC 71 ms
22,292 KB
testcase_09 AC 68 ms
24,088 KB
testcase_10 AC 75 ms
22,420 KB
testcase_11 AC 71 ms
24,224 KB
testcase_12 AC 72 ms
22,228 KB
testcase_13 AC 73 ms
24,316 KB
testcase_14 AC 63 ms
23,856 KB
testcase_15 AC 68 ms
21,836 KB
testcase_16 AC 74 ms
24,296 KB
testcase_17 AC 74 ms
22,512 KB
testcase_18 AC 72 ms
20,524 KB
testcase_19 AC 75 ms
22,548 KB
testcase_20 AC 62 ms
23,872 KB
testcase_21 AC 61 ms
23,684 KB
testcase_22 AC 61 ms
23,784 KB
testcase_23 AC 61 ms
19,804 KB
testcase_24 AC 67 ms
21,936 KB
testcase_25 AC 67 ms
22,000 KB
testcase_26 AC 62 ms
19,700 KB
testcase_27 AC 62 ms
21,864 KB
testcase_28 AC 59 ms
21,824 KB
testcase_29 AC 73 ms
24,304 KB
testcase_30 AC 68 ms
22,144 KB
testcase_31 AC 59 ms
21,716 KB
testcase_32 AC 62 ms
21,784 KB
testcase_33 AC 61 ms
21,776 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
namespace BlocksIn
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			int m = 0;
			int n = 0;
			string M = Console.ReadLine();
			string N = Console.ReadLine();
			bool flgM = int.TryParse(M, out m);
			bool flgN = int.TryParse(N, out n);
			if (!flgM || m == 0)
			{
				Console.WriteLine("Erorr WidthSize");
				return;
			}
			if (!flgN || n == 0)
			{
				Console.WriteLine("Erorr WidthSize");
				return;
			}
			List<int> blocks = new List<int>();
			string Blocks = Console.ReadLine();
			string[] blks = Blocks.Split(new char[] { ' ' });
			for (int i = 0; i < n; i++)
			{
				blocks.Add(int.Parse(blks[i]));
			}
			int all = 0;
			List<int> res = blocks.OrderBy(x => x).Where(x => (all += x) <= m).ToList();
			
			Console.WriteLine(res.Count);
		}
	}
}
0