結果

問題 No.688 E869120 and Constructing Array 2
ユーザー keymoonkeymoon
提出日時 2018-05-18 22:51:00
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 978 bytes
コンパイル時間 2,400 ms
コンパイル使用メモリ 105,612 KB
実行使用メモリ 23,688 KB
最終ジャッジ日時 2023-09-21 20:00:29
合計ジャッジ時間 4,313 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,552 KB
testcase_01 AC 62 ms
21,716 KB
testcase_02 AC 61 ms
21,660 KB
testcase_03 AC 60 ms
21,676 KB
testcase_04 AC 60 ms
19,516 KB
testcase_05 AC 60 ms
23,632 KB
testcase_06 AC 61 ms
21,580 KB
testcase_07 AC 61 ms
21,808 KB
testcase_08 AC 60 ms
23,688 KB
testcase_09 WA -
testcase_10 AC 61 ms
23,596 KB
testcase_11 AC 61 ms
23,576 KB
testcase_12 AC 60 ms
21,748 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<long> pow = new List<long>(){ 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()
    {
        long n = long.Parse(Console.ReadLine());
        if (n == 0) Console.WriteLine('0');
        //1の数
        for (int i = 2; i <= 30; i++)
        {
            long p = (i * (i - 1) / 2);
            if (n % p != 0) continue;
            if (!pow.Contains(n / p)) continue;
            int index = pow.IndexOf(n / p);
            if (i + index > 30) continue;
            Console.WriteLine(index + i);
            Console.WriteLine(string.Join(" ", Enumerable.Repeat('1', i).Concat(Enumerable.Repeat('0', index))));
            return;
        }
    }
}
0