結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
AreTrash
|
| 提出日時 | 2016-04-13 07:49:16 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 5,000 ms |
| コード長 | 879 bytes |
| コンパイル時間 | 1,108 ms |
| コンパイル使用メモリ | 112,148 KB |
| 実行使用メモリ | 27,956 KB |
| 最終ジャッジ日時 | 2024-11-18 08:29:59 |
| 合計ジャッジ時間 | 3,284 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Collections.Generic;
using System.Linq;
namespace No5_1 {
public class Program {
public static void Main(string[] args) {
var l = Read(Convert.ToInt32);
Read(Convert.ToInt32);
var wn = ReadList(Convert.ToInt32);
wn.Sort();
var sum = 0;
var cnt = 0;
foreach(var w in wn){
if((sum += w) <= l) cnt++;
else break;
}
Console.WriteLine(cnt);
}
public static TOutput Read<TOutput>(Converter<string, TOutput> converter) {
return converter(Console.ReadLine());
}
public static List<TOutput> ReadList<TOutput>(Converter<string, TOutput> converter, char c = ' ') {
return Console.ReadLine()?.Split(c).ToList().ConvertAll(converter);
}
}
}
AreTrash