結果
| 問題 |
No.689 E869120 and Constructing Array 3
|
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2018-05-19 02:25:03 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 1,000 ms |
| コード長 | 662 bytes |
| コンパイル時間 | 833 ms |
| コンパイル使用メモリ | 104,064 KB |
| 実行使用メモリ | 18,944 KB |
| 最終ジャッジ日時 | 2024-06-28 14:17:48 |
| 合計ジャッジ時間 | 2,375 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
コンパイルメッセージ
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 No689
{
public class Program
{
public static void Main(string[] args)
{
var K = int.Parse(Console.ReadLine());
var ans = new List<int>();
for (var i = 1; i * (i - 1) / 2 <= K; i++) ans.Add(1);
var x = K - ans.Count * (ans.Count - 1) / 2;
ans.AddRange(Enumerable.Repeat(3, x / 2));
ans.AddRange(Enumerable.Repeat(5, x % 2));
ans.Add(8);
ans.Add(20);
Console.WriteLine(ans.Count);
Console.WriteLine(string.Join(" ", ans));
}
}
}
AreTrash