結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
nuwasogi
|
| 提出日時 | 2015-11-22 14:44:50 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 5,000 ms |
| コード長 | 730 bytes |
| コンパイル時間 | 714 ms |
| コンパイル使用メモリ | 110,880 KB |
| 実行使用メモリ | 28,164 KB |
| 最終ジャッジ日時 | 2024-11-18 07:50:12 |
| 合計ジャッジ時間 | 2,457 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Linq;
namespace Suuji_no_Block_CS
{
class Program
{
static int Solve(int L, int[] W)
{
int ret=0;
foreach(int x in W)
{
L -= x;
if(L < 0)
{
break;
}
ret++;
}
return ret;
}
static void Main(string[] args)
{
int L = int.Parse(Console.ReadLine());
int N = int.Parse(Console.ReadLine());
int[] W = Console.ReadLine().Split(' ').Select(value => int.Parse(value)).OrderBy(value => value).ToArray();
Console.WriteLine(Solve(L, W));
}
}
}
nuwasogi