結果

問題 No.688 E869120 and Constructing Array 2
ユーザー keymoonkeymoon
提出日時 2018-05-18 22:30:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 832 bytes
コンパイル時間 2,473 ms
コンパイル使用メモリ 103,448 KB
実行使用メモリ 25,768 KB
最終ジャッジ日時 2023-09-21 19:50:54
合計ジャッジ時間 5,730 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
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 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
            Console.WriteLine(string.Join(" ", Enumerable.Repeat('1', i).Concat(Enumerable.Repeat('0', pow.IndexOf(n / p)))));
            return;
        }
    }
}
0