結果
| 問題 | No.688 E869120 and Constructing Array 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-22 18:03:09 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 881 bytes |
| 記録 | |
| コンパイル時間 | 2,960 ms |
| コンパイル使用メモリ | 110,364 KB |
| 実行使用メモリ | 28,572 KB |
| 最終ジャッジ日時 | 2026-03-29 04:50:16 |
| 合計ジャッジ時間 | 2,477 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 2 WA * 8 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Text;
public class Program
{
static void Main()
{
long K = long.Parse(Console.ReadLine());
int ZeroCount = 0;
if (K == 0){
Console.WriteLine(1);
Console.WriteLine(1);
return;
}
while(K % 2 == 0){
K = K / 2;
ZeroCount++;
}
while(Math.Sqrt(K*8 + 1) % 1.0f != 0 || ((Math.Sqrt(K*8 + 1) + 1) / 2) % 1.0f != 0){
K = K *2;
ZeroCount--;
}
var OneCount = (int)((Math.Sqrt(K*8 + 1) + 1) / 2);
Console.WriteLine(OneCount + ZeroCount);
var x = new char[OneCount + ZeroCount];
for(var i = OneCount + ZeroCount -1;i>=0;i--){
x[i]= i < OneCount ? '0': '1';
}
Console.WriteLine(string.Join(" ",x));
}
}