結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-30 18:20:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 421 bytes |
| コンパイル時間 | 573 ms |
| コンパイル使用メモリ | 69,352 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 09:15:38 |
| 合計ジャッジ時間 | 1,321 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int K, i, j;
cin >> K;
for (i = 1; i <= 30; ++i) {
for (j = 0; j <= 30 - i; ++j) {
if ((i - 1) * i / 2 * (int)pow(2, j) == K) break;
}
if (j != 31 - i) break;
}
cout << i + j << endl;
for (int k = 0; k < i; ++k) cout << "1 ";
for (int l = 0; l < j; ++l) cout << "0 ";
}