結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-09-06 14:45:00 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 774 bytes |
| コンパイル時間 | 1,361 ms |
| コンパイル使用メモリ | 103,680 KB |
| 実行使用メモリ | 18,048 KB |
| 最終ジャッジ日時 | 2024-11-22 01:31:45 |
| 合計ジャッジ時間 | 3,142 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 3 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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));
}
}
bluemegane