結果

問題 No.688 E869120 and Constructing Array 2
ユーザー yuruhiyayuruhiya
提出日時 2019-03-17 17:35:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,066 bytes
コンパイル時間 1,895 ms
コンパイル使用メモリ 144,744 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 11:01:43
合計ジャッジ時間 3,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("")
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

bool Check(int n) {
	int a = sqrt(n);
	return a * (a + 1) == n;
}

int main() {
	int k; cin >> k;

	int c0, c1;
	for (int i = 0; true; i++) {
		int j = pow(2, i);
		if (k%j == 0) {
			int l = k / j;
			if (Check(l * 2)) { c0 = i; c1 = sqrt(l * 2) + 1; break; }
		}
	}
	rep(i, c0)cout << "0 ";
	rep(i, c1)cout << "1" << (i == c1 - 1 ? "" : " ");
}
0