結果

問題 No.688 E869120 and Constructing Array 2
ユーザー keymoonkeymoon
提出日時 2018-05-18 22:31:57
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 905 bytes
コンパイル時間 2,148 ms
コンパイル使用メモリ 103,400 KB
実行使用メモリ 23,684 KB
最終ジャッジ日時 2023-09-21 19:52:28
合計ジャッジ時間 4,981 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
23,608 KB
testcase_01 AC 60 ms
21,620 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 60 ms
21,568 KB
testcase_11 AC 61 ms
23,684 KB
testcase_12 AC 61 ms
21,616 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.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using static System.Math;

class P
{
    static List<int> pow = new List<int>(){ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912 };
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        //1の数
        for (int i = 2; i <= 30; i++)
        {
            int p = (i * (i - 1) / 2);
            if (n % p != 0 || i + n / p > 30) continue;
            if (!pow.Contains(n / p)) continue;
            int index = pow.IndexOf(n / p);
            Console.WriteLine(index + i);
            Console.WriteLine(string.Join(" ", Enumerable.Repeat('1', i).Concat(Enumerable.Repeat('0', index))));
            return;
        }
    }
}
0