結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-22 18:01:32 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 744 bytes |
| コンパイル時間 | 818 ms |
| コンパイル使用メモリ | 112,760 KB |
| 実行使用メモリ | 30,988 KB |
| 最終ジャッジ日時 | 2024-07-07 14:06:13 |
| 合計ジャッジ時間 | 4,473 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 1 WA * 8 TLE * 1 |
コンパイルメッセージ
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;
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));
}
}