結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2020-01-03 16:00:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 535 ms / 5,000 ms |
コード長 | 664 bytes |
コンパイル時間 | 3,086 ms |
コンパイル使用メモリ | 103,296 KB |
実行使用メモリ | 19,072 KB |
最終ジャッジ日時 | 2024-11-22 19:11:52 |
合計ジャッジ時間 | 7,105 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; class Yukicoder005{ public static void Main(string[] args){ int L = int.Parse(Console.ReadLine()); int N = int.Parse(Console.ReadLine()); string[] W = Console.ReadLine().Split(' '); int[] sort = new int[N]; int Eva; int count = 0; int a; for(int i = 0; i < N; i++){ sort[i] = int.Parse(W[i]); } for(int j = 0; j < N; j++){ for(int K = N-1; K > 0; K--){ if(sort[K] < sort[K-1]){ Eva = sort[K]; sort[K] = sort[K-1]; sort[K-1] = Eva; } } } for(a = 0; a < N; a++){ count += sort[a]; if(count > L){ break; } } Console.WriteLine(a); } }