結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
meimaruEngineer
|
| 提出日時 | 2019-05-28 09:00:02 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 5,000 ms |
| コード長 | 862 bytes |
| コンパイル時間 | 837 ms |
| コンパイル使用メモリ | 112,580 KB |
| 実行使用メモリ | 26,924 KB |
| 最終ジャッジ日時 | 2024-09-17 15:37:47 |
| 合計ジャッジ時間 | 2,549 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / 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;
using System.Collections.Generic;
using System.IO;
using System.Text;
class No5
{
static int L = 0;
static int N = 0;
static string[] W;
static int[] IW;
static void Main(string[] args)
{
int L = int.Parse(Console.ReadLine());
int N = int.Parse(Console.ReadLine());
string[] W = Console.ReadLine().Split(' ');
int[] IW = new int[W.Length];
int count = 0;
for (int i = 0; i < W.Length; i++)
{
IW[i] = int.Parse(W[i]);
}
Array.Sort(IW);
for (int i = 0; i < W.Length; i++)
{
L -= IW[i];
if (L < 0)
{
break;
}
else
{
count++;
}
}
Console.WriteLine(count);
}
}
meimaruEngineer