結果

問題 No.542 1円玉と5円玉
ユーザー bayashiko_rbayashiko_r
提出日時 2018-12-02 04:47:32
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 907 bytes
コンパイル時間 2,405 ms
コンパイル使用メモリ 100,520 KB
実行使用メモリ 22,640 KB
最終ジャッジ日時 2023-09-09 23:25:24
合計ジャッジ時間 4,173 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,752 KB
testcase_01 AC 59 ms
22,640 KB
testcase_02 AC 58 ms
20,660 KB
testcase_03 AC 57 ms
20,628 KB
testcase_04 AC 60 ms
20,612 KB
testcase_05 AC 60 ms
20,748 KB
testcase_06 AC 61 ms
20,660 KB
testcase_07 AC 62 ms
20,656 KB
testcase_08 AC 62 ms
20,596 KB
testcase_09 AC 62 ms
22,632 KB
testcase_10 AC 59 ms
20,584 KB
testcase_11 AC 61 ms
20,728 KB
testcase_12 AC 69 ms
20,584 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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);
        }
    }
}
0