結果
問題 | No.688 E869120 and Constructing Array 2 |
ユーザー | uma-pinehill |
提出日時 | 2018-05-22 18:01:32 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 744 bytes |
コンパイル時間 | 2,648 ms |
コンパイル使用メモリ | 102,308 KB |
実行使用メモリ | 42,688 KB |
最終ジャッジ日時 | 2023-09-21 20:41:16 |
合計ジャッジ時間 | 6,586 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | AC | 60 ms
22,880 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
コンパイルメッセージ
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)); } }