結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
_mi_lin_
|
| 提出日時 | 2019-04-05 17:40:14 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,251 bytes |
| コンパイル時間 | 974 ms |
| コンパイル使用メモリ | 108,308 KB |
| 実行使用メモリ | 28,188 KB |
| 最終ジャッジ日時 | 2024-06-11 21:54:54 |
| 合計ジャッジ時間 | 3,561 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 10 |
コンパイルメッセージ
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;
using System.Text;
using System.Threading.Tasks;
namespace No5mathblock
{
class Program
{
static void Main(string[] args)
{
//数値の入力
string[] L = Console.ReadLine().Split(' ');
string[] N = Console.ReadLine().Split(' ');
string[] W = Console.ReadLine().Split(' ');
//箱の幅
int box = int.Parse(L[0]);
//ブロックの数
int block = int.Parse(N[0]);
//ブロックの幅
int[] blockwi = new int[W.Length];
for (int i=0 ; i < W.Length; i++)
{
blockwi[i] = int.Parse(W[i]);
}
//小さい順に並べ替え
Array.Sort(blockwi);
//箱に何個入るか
int allblockwi = 0;
int ans = 0;
for (int j = 0; j < W.Length; j++)
{
if (box < allblockwi)
{
break;
}
allblockwi += blockwi[j];
ans += 1;
}
//結果表示
Console.WriteLine(ans - 1);
}
}
}
_mi_lin_