結果
| 問題 | No.542 1円玉と5円玉 | 
| コンテスト | |
| ユーザー |  norioc | 
| 提出日時 | 2017-07-15 20:28:12 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 40 ms / 2,000 ms | 
| コード長 | 924 bytes | 
| コンパイル時間 | 1,000 ms | 
| コンパイル使用メモリ | 113,772 KB | 
| 実行使用メモリ | 28,440 KB | 
| 最終ジャッジ日時 | 2024-10-08 02:39:50 | 
| 合計ジャッジ時間 | 2,230 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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.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 = 1; i <= a; i++)
            hs.Add(i);
        for (int i = 1; i <= b; i++)
            hs.Add(i * 5);
        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);
    }
}
            
            
            
        