結果

問題 No.542 1円玉と5円玉
ユーザー noriocnorioc
提出日時 2017-07-15 20:33:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 860 ms
コンパイル使用メモリ 114,564 KB
実行使用メモリ 28,332 KB
最終ジャッジ日時 2024-10-08 02:40:21
合計ジャッジ時間 1,847 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static void Calc(int a, int b) {
        var hs = new HashSet<int>();
        for (int i = 0; i <= a; i++) {
            for (int j = 0; j <= b; j++) {
                if (i == 0 && j == 0) continue;
                hs.Add(i + j * 5);
            }
        }

        foreach (var e in hs.OrderBy(e => e)) {
            Console.WriteLine(e);
        }
    }

    static void Main() {
        var ab = ReadInts();
        int a = ab[0], b = ab[1];
        Calc(a, b);
    }
}
0