結果

問題 No.156 キャンディー・ボックス
ユーザー chankou0920chankou0920
提出日時 2017-10-16 12:40:19
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 2,742 ms
コンパイル使用メモリ 102,456 KB
実行使用メモリ 22,868 KB
最終ジャッジ日時 2023-09-19 03:28:10
合計ジャッジ時間 6,269 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,708 KB
testcase_01 AC 63 ms
22,740 KB
testcase_02 AC 60 ms
22,812 KB
testcase_03 AC 60 ms
20,776 KB
testcase_04 AC 61 ms
22,844 KB
testcase_05 AC 60 ms
22,792 KB
testcase_06 AC 60 ms
20,644 KB
testcase_07 AC 60 ms
20,784 KB
testcase_08 AC 60 ms
22,692 KB
testcase_09 AC 60 ms
18,680 KB
testcase_10 AC 60 ms
18,748 KB
testcase_11 AC 62 ms
22,800 KB
testcase_12 AC 62 ms
20,728 KB
testcase_13 AC 60 ms
20,688 KB
testcase_14 AC 60 ms
20,788 KB
testcase_15 AC 60 ms
18,744 KB
testcase_16 AC 61 ms
22,804 KB
testcase_17 AC 60 ms
20,776 KB
testcase_18 AC 59 ms
20,880 KB
testcase_19 AC 60 ms
22,736 KB
testcase_20 AC 60 ms
22,752 KB
testcase_21 AC 60 ms
22,760 KB
testcase_22 AC 59 ms
20,784 KB
testcase_23 AC 60 ms
22,868 KB
testcase_24 AC 59 ms
20,732 KB
testcase_25 AC 58 ms
20,896 KB
testcase_26 AC 60 ms
20,760 KB
testcase_27 AC 60 ms
20,776 KB
testcase_28 AC 59 ms
20,724 KB
testcase_29 AC 60 ms
22,712 KB
testcase_30 AC 60 ms
22,744 KB
testcase_31 AC 60 ms
22,712 KB
testcase_32 AC 60 ms
22,732 KB
testcase_33 AC 61 ms
20,824 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program {
	public static void Main(string[] args) {
		int m = int.Parse(Console.ReadLine().Split(' ')[1]);
		string[] s = Console.ReadLine().Split(' ');
		
		int[] c = new int[s.Length];
		for (int i = 0; i < c.Length; i++) {
			c[i] = int.Parse(s[i]);
		}
		Array.Sort(c);
		
		int count = 0;
		for (int i = 0; i < c.Length; i++) {
			m -= c[i];
			if (m < 0) {
				break;
			}
			count++;
		}
		Console.WriteLine(count);
	}
}
0