結果

問題 No.688 E869120 and Constructing Array 2
ユーザー kuuso1
提出日時 2018-05-19 05:13:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 699 bytes
コンパイル時間 1,393 ms
コンパイル使用メモリ 167,224 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-07 13:55:49
合計ジャッジ時間 2,081 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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