結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2017-12-05 16:45:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 945 bytes |
コンパイル時間 | 797 ms |
コンパイル使用メモリ | 109,900 KB |
実行使用メモリ | 28,556 KB |
最終ジャッジ日時 | 2024-11-28 16:48:18 |
合計ジャッジ時間 | 5,230 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 7 RE * 7 |
コンパイルメッセージ
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; public class Hello{ static void Sort(int[] a){ for(int x = 0;x < a.Length - 1;x++){ for(int y = x + 1;y < a.Length;y++){ int temp = 0; if(a[x] > a[y]){ temp = a[x]; a[x] = a[y]; a[y] = temp; } } } } public static void Main(){ int L = int.Parse(Console.ReadLine()); int N = int.Parse(Console.ReadLine()); string[] input = Console.ReadLine().Split(' '); int[] width = new int[N]; for(int i = 0;i < N;i++){ width[i] = int.Parse(input[i]); } Sort(width); int cap = 0; int count = 0; while(cap < L){ cap += width[count]; count++; } Console.WriteLine(count - 1); } }