結果

問題 No.542 1円玉と5円玉
ユーザー boya978boya978
提出日時 2020-05-02 23:44:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 782 bytes
コンパイル時間 3,233 ms
コンパイル使用メモリ 102,464 KB
実行使用メモリ 25,376 KB
最終ジャッジ日時 2023-08-30 12:22:24
合計ジャッジ時間 4,427 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
23,320 KB
testcase_01 AC 69 ms
23,200 KB
testcase_02 AC 70 ms
23,140 KB
testcase_03 AC 68 ms
23,196 KB
testcase_04 AC 69 ms
25,256 KB
testcase_05 AC 70 ms
23,256 KB
testcase_06 AC 71 ms
23,280 KB
testcase_07 AC 71 ms
23,284 KB
testcase_08 AC 71 ms
23,300 KB
testcase_09 AC 72 ms
23,276 KB
testcase_10 AC 70 ms
25,376 KB
testcase_11 AC 71 ms
23,392 KB
testcase_12 AC 72 ms
23,292 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.Linq;
using System.Collections.Generic;
public class Hello{
    public static void Main(){

        int[] ns = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int oneCoins = ns[0], fiveCoins = ns[1];
        
        var ones = new List<int>();
        var fives = new List<int>();
        var vals = new SortedSet<int>();
        
        for(int i=1;i<=oneCoins;i++)
        {
            ones.Add(i);
            vals.Add(i);
        }
        for(int i=5;i<=fiveCoins*5;i+=5)
        {
            fives.Add(i);
            vals.Add(i);
        }

        foreach(int Yen1 in ones)
            foreach(int Yen5 in fives)
                vals.Add(Yen1+Yen5);

        foreach(int val in vals)
            Console.WriteLine(val);
    }
}
0