結果
問題 | No.542 1円玉と5円玉 |
ユーザー |
![]() |
提出日時 | 2018-12-02 04:47:32 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 907 bytes |
コンパイル時間 | 1,126 ms |
コンパイル使用メモリ | 110,240 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-06-27 15:51:22 |
合計ジャッジ時間 | 2,168 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
コンパイルメッセージ
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; class Program { static void Main(string[] args) { //入力 string s = Console.ReadLine(); string[] t = s.Split(' '); int A = int.Parse(t[0]); int B = int.Parse(t[1]); //答えになるList List<int> list = new List<int> { }; //全パターンについて試していく for (int x5 = 0; x5 <= B; x5++) { for (int x1 = 0; x1 <= A; x1++) { int value = 5 * x5 + 1 * x1; if (!list.Contains(value)) { list.Add(value); } } } //リストから0を削除する list.Remove(0); //リストを並び替え list.Sort(); //出力 foreach(int l in list) { Console.WriteLine(l); } } }