結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
ganariya2525
|
| 提出日時 | 2016-12-22 22:02:44 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,964 bytes |
| コンパイル時間 | 1,225 ms |
| コンパイル使用メモリ | 104,832 KB |
| 実行使用メモリ | 17,920 KB |
| 最終ジャッジ日時 | 2024-12-14 14:54:54 |
| 合計ジャッジ時間 | 2,903 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 5 RE * 29 |
コンパイルメッセージ
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 StartFinish
{
class Putin
{
public static int bighaba(int haba)
{
if (haba <= 1 || haba <= 10000)
{
return haba;
}
Console.WriteLine("正しい値を入力してください。");
return 0;
}
public static int smallhaba(int haba)
{
if (haba <= 1 || haba <= 10000)
{
return haba;
}
Console.WriteLine("正しい値を入力してください。");
return 0;
}
}
class Program
{
static void Main(string[] args)
{
bool flag = true;
while (flag)
{
Console.WriteLine("大きな箱の幅を入力してください");
int L = Putin.bighaba(int.Parse(Console.ReadLine()));
if (L == 0)
{
continue;
}
Console.WriteLine("ブロックの数を入力してください。");
int N = Putin.smallhaba(int.Parse(Console.ReadLine()));
if (N == 0)
{
continue;
}
List<int> Wlist = new List<int>();
Console.WriteLine("各ブロックの幅を入力してください");
for(int i = 0; i < N; i++)
{
Wlist.Add(int.Parse(Console.ReadLine()));
}
Wlist.Sort();
for (int i = 0; (L>=0)&(i!=Wlist.Count) ; ++i)
{
L -= Wlist[i];
if(i>=1)
Console.Write("{0} ",Wlist[i-1]);
}
flag = false;
}
}
}
}
ganariya2525