結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2016-04-13 07:49:16 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 5,000 ms |
| コード長 | 879 bytes |
| 記録 | |
| コンパイル時間 | 2,550 ms |
| コンパイル使用メモリ | 107,008 KB |
| 実行使用メモリ | 20,736 KB |
| 最終ジャッジ日時 | 2026-05-12 20:49:50 |
| 合計ジャッジ時間 | 4,484 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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