結果
| 問題 |
No.542 1円玉と5円玉
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-26 18:01:54 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 34 ms / 2,000 ms |
| コード長 | 885 bytes |
| コンパイル時間 | 779 ms |
| コンパイル使用メモリ | 105,088 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2024-11-21 20:07:10 |
| 合計ジャッジ時間 | 1,751 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / 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.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YukiCoder
{
public static class OneAndFive
{
public static void Main()
{
List<int> AmountMoney = new List<int>();
string[] Amount = Console.ReadLine().Split(' ');
int OneAmount = int.Parse(Amount[0]);
int FiveAmount = int.Parse(Amount[1]);
for (int One = 1; One <= OneAmount; One++)
{
AmountMoney.Add(One);
}
for(int Five = 1; Five <= FiveAmount; Five++)
{
AmountMoney.Add(Five * 5);
}
for(int Five = 1; Five <= FiveAmount; Five++)
{
for (int One = 1; One <= OneAmount; One++)
{
AmountMoney.Add(One + Five * 5);
}
}
AmountMoney.Sort();
foreach(var Money in AmountMoney.Distinct())
{
Console.WriteLine(Money);
}
Console.ReadKey();
}
}
}