結果
問題 | No.542 1円玉と5円玉 |
ユーザー |
|
提出日時 | 2017-10-11 09:27:48 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 43 ms / 2,000 ms |
コード長 | 1,145 bytes |
コンパイル時間 | 1,708 ms |
コンパイル使用メモリ | 106,496 KB |
実行使用メモリ | 19,200 KB |
最終ジャッジ日時 | 2024-11-17 09:20:25 |
合計ジャッジ時間 | 2,871 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.Linq; using System.Collections.Generic; public class yukicoder { public static void Main() { int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); List<int> one = new List<int>(); List<int> five = new List<int>(); List<int> ans = new List<int>(); for(int i = 1; i <= input[0]; i++) { one.Add(i); if(!ans.Contains(i)) { ans.Add(i); } } for(int i = 1; i <= input[1]; i++) { five.Add(i * 5); if(!ans.Contains(i * 5)) { ans.Add(i * 5); } } for(int j = 0; j <= five.Count - 1; j++) { for(int i = 0; i <= one.Count - 1; i++) { int temp = one[i] + five[j]; if(!ans.Contains(temp)) { ans.Add(temp); } } } ans.Sort(); ans.ToList().ForEach(x => Console.WriteLine(x)); } }