結果
| 問題 |
No.542 1円玉と5円玉
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-03 14:17:26 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 916 bytes |
| コンパイル時間 | 1,285 ms |
| コンパイル使用メモリ | 109,744 KB |
| 実行使用メモリ | 19,456 KB |
| 最終ジャッジ日時 | 2024-07-01 05:36:59 |
| 合計ジャッジ時間 | 2,075 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / 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.Generic;
using System.Linq;
namespace StudyApp
{
class Program
{
static void Main(string[] args)
{
string[] inputs = Console.ReadLine().Trim().Split(' ');
int oneCoin = int.Parse(inputs[0]);
int fiveCoin = int.Parse(inputs[1]);
var results = GetCombination(oneCoin, fiveCoin).Distinct().OrderBy(data => data);
foreach (var result in results)
Console.WriteLine(result);
}
private static IEnumerable<int> GetCombination(int oneCoin, int fiveCoin)
{
for (int i = 0; i <= fiveCoin; i++)
{
for (int j = 0; j <= oneCoin; j++)
{
int total = i * 5 + j;
if (total != 0)
yield return total;
}
}
}
}
}