結果

問題 No.688 E869120 and Constructing Array 2
ユーザー kuuso1kuuso1
提出日時 2018-05-19 05:13:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 699 bytes
コンパイル時間 1,480 ms
コンパイル使用メモリ 163,556 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-21 20:25:41
合計ジャッジ時間 2,534 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <bits/stdc++.h>
#include <time.h>
#include <sys/timeb.h>
#include <cstdio>
#include <sys/time.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define ulong unsigned long long int

int main(){
	ll K;
	cin >> K;
	
	if(K == 0){
		cout << "0 0 0 0 0 0 0 1 0 0 0 0 0 0" << endl;
		return 0;
	}
	
	for(int i=2;i<=30;i++){
		ll b = i * (i - 1) / 2;
		for(int k=0;k<=30 - i;k++){
			if(b * (1 << k) == K){
				int N = i + k;
				printf("%d\n", N);
				for(int j=0;j<i;j++){
					if(j != 0) cout << " ";
					cout << "1";
				}
				for(int j=0;j<k;j++){
					cout << " 0";
				}
				cout << endl;
				return 0;
				
			}
		}
		
		
	}
	
	
	
    return 0;
}
0