結果

問題 No.689 E869120 and Constructing Array 3
ユーザー AreTrashAreTrash
提出日時 2018-05-19 02:25:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 1,000 ms
コード長 662 bytes
コンパイル時間 2,597 ms
コンパイル使用メモリ 105,140 KB
実行使用メモリ 23,716 KB
最終ジャッジ日時 2023-09-10 23:35:46
合計ジャッジ時間 4,578 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,552 KB
testcase_01 AC 60 ms
21,716 KB
testcase_02 AC 61 ms
21,632 KB
testcase_03 AC 61 ms
21,652 KB
testcase_04 AC 61 ms
23,716 KB
testcase_05 AC 61 ms
21,600 KB
testcase_06 AC 61 ms
21,616 KB
testcase_07 AC 61 ms
23,632 KB
testcase_08 AC 61 ms
21,660 KB
testcase_09 AC 61 ms
23,676 KB
testcase_10 AC 61 ms
19,680 KB
testcase_11 AC 61 ms
21,688 KB
testcase_12 AC 62 ms
21,656 KB
testcase_13 AC 61 ms
21,628 KB
testcase_14 AC 60 ms
21,624 KB
testcase_15 AC 60 ms
19,552 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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));
        }
    }
}
0