結果
問題 |
No.688 E869120 and Constructing Array 2
|
ユーザー |
![]() |
提出日時 | 2018-09-06 15:30:20 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 1,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 2,900 ms |
コンパイル使用メモリ | 112,692 KB |
実行使用メモリ | 26,192 KB |
最終ジャッジ日時 | 2024-11-22 04:21:20 |
合計ジャッジ時間 | 4,142 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
コンパイルメッセージ
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; } for (int i = 2; i <= 30; i++) for (int j = 0; j <= i - 2; j++) { var w = Math.Pow(2, j) * ((i - j) * (i - j - 1) / 2); if (w == k) { putAns(i, j); goto end; } } 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)); } }