結果

問題 No.688 E869120 and Constructing Array 2
ユーザー bluemeganebluemegane
提出日時 2018-09-06 14:45:00
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 774 bytes
コンパイル時間 979 ms
コンパイル使用メモリ 106,724 KB
実行使用メモリ 26,168 KB
最終ジャッジ日時 2024-05-01 19:22:25
合計ジャッジ時間 2,642 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 24 ms
18,304 KB
testcase_03 AC 25 ms
18,176 KB
testcase_04 AC 24 ms
18,176 KB
testcase_05 AC 24 ms
18,048 KB
testcase_06 AC 24 ms
18,048 KB
testcase_07 WA -
testcase_08 AC 25 ms
17,664 KB
testcase_09 AC 23 ms
17,664 KB
testcase_10 AC 23 ms
17,920 KB
testcase_11 AC 24 ms
17,920 KB
testcase_12 AC 24 ms
17,920 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        var k = int.Parse(Console.ReadLine().Trim());
        if (k == 0) { Console.WriteLine(1); Console.WriteLine(1); goto end; }
        if (k == 1) { Console.WriteLine(2); Console.WriteLine("1 1"); goto end; }
        for (int i = 2; i <= 30; i++)
        {
            for (int j = 2; j < i -1; j++)
            {
                var w = (int)Math.Pow(2, j - 1) * (i - j) * (i - j - 1);
                if (w == k) { putAns(i, j); break; }
            }
        }
        end:;
    }
    public static void putAns (int i, int j)
    {
        Console.WriteLine(i);
        var a = new int[i];
        for (int x = 0; x < i - j; x++) a[x] = 1;
        Console.WriteLine(string.Join(" ",a));
    }
}
0