結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2022-05-24 14:30:39 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 378 ms / 5,000 ms |
コード長 | 1,121 bytes |
コンパイル時間 | 3,172 ms |
コンパイル使用メモリ | 107,484 KB |
実行使用メモリ | 26,976 KB |
最終ジャッジ日時 | 2024-09-20 14:23:24 |
合計ジャッジ時間 | 5,655 ms |
ジャッジサーバーID (参考情報) |
judge2 / 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; namespace yukicoder { class Program { static void Main(string[] args) { int a,b,e; int num = 0; int sum = 0; a = int.Parse(Console.ReadLine()); b = int.Parse(Console.ReadLine()); string[] c = Console.ReadLine().Split(' '); int[] d = new int[c.Length]; for(int i = 0; i < c.Length; i++) { d[i] = int.Parse(c[i]); } for (int x = 0; x <= d.Length;x++) { for (int y = x; y < d.Length; y++) { if (d[y]<d[x]) { e = d[x]; d[x] = d[y]; d[y] = e; } } } for(int s = 0; s < d.Length; s++) { sum += d[s]; if (sum > a) { break; } num++; } Console.WriteLine(num.ToString()); } } }