結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
aaa
|
| 提出日時 | 2018-07-18 10:17:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 1,205 bytes |
| コンパイル時間 | 803 ms |
| コンパイル使用メモリ | 94,224 KB |
| 実行使用メモリ | 13,632 KB |
| 最終ジャッジ日時 | 2024-11-30 07:19:15 |
| 合計ジャッジ時間 | 6,530 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 1 OLE * 2 |
ソースコード
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
using namespace std;
int main() {
long i, j;
int k;
cin >> k;
for (i = 2; i <= 30; i++) {
long num = 0;
for (int h = i - 1; h >= 1; h--) {
num += h;
}
if (num == k) {
for (i; i > 0; j--) {
cout << 1;
if (i - 1 != 0) {
cout << " ";
}
else {
cout << endl;
}
}
getchar();
getchar();
return 0;
}
for (j = 1; j <= 30 - i; j++) {
//long num2 = j*i + i;
long num2 = ( pow(2,j)-1) * num + num;
//cout << "num2->" << num2 << endl;
//cout << "j->" << j << " i->" << i << endl << endl;
if (num2 == k) {
cout << j + i << endl;
for (int jj = 0; jj < j; jj++) {
cout << 0 << " ";
}
for (int jj = 0; jj < i; jj++) {
cout << 1;
if (jj + 1 != i) {
cout << " ";
}
else {
cout << endl;
}
}
getchar();
getchar();
return 0;
}
}
}
getchar();
getchar();
return 0;
}
aaa