結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
_mi_lin_
|
| 提出日時 | 2019-04-05 17:45:01 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,252 bytes |
| コンパイル時間 | 1,673 ms |
| コンパイル使用メモリ | 110,112 KB |
| 実行使用メモリ | 29,292 KB |
| 最終ジャッジ日時 | 2024-06-11 22:03:45 |
| 合計ジャッジ時間 | 4,088 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 24 |
コンパイルメッセージ
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 = 1;
for (int j = 0; j < W.Length; j++)
{
if (box < allblockwi)
{
break;
}
allblockwi += blockwi[j];
ans += 1;
}
//結果表示
Console.WriteLine(ans - 1);
}
}
}
_mi_lin_