結果

問題 No.688 E869120 and Constructing Array 2
ユーザー aguroshouaguroshou
提出日時 2018-05-19 00:43:49
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,130 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 60,204 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-21 20:12:11
合計ジャッジ時間 1,716 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include <algorithm>
#include<string>
using namespace std;

int main()
{
	long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	int k;
	cin >> k;
	if (k==0)
	{
		cout << "1"<<endl;
		cout << "0";
		cout << endl;
		return 0;
	}
	while (k > 10000&&k%2==0)
	{
		k /= 2;
		h++;
	}
	for ( a = 2; a <= 30; a++)
	{
		b = a - 1;
	
		if (k * 2 / (a*b) == 1&& k * 2 % (a*b) == 0)
		{
			for (c = 0; c < a; c++)
			{
				cout << "1 ";






			}
			cout << endl;
			return 0;
		}
	}
	for ( a = 1; a <= 30; a++)
	{
		if (a>1)
		{
		b = a - 1;

		}
		else
		{
			b = 1;
		}
		
		if (k%(a*b)==0)
		{
			c = k / (a*b);
			if (!(c & (c - 1)))
			{
				

				d = 0;
				while (c != 1)
				{
					d++;
					c /= 2;
				}
				if (a == 1)
				{
					a++;
					d--;

				}
				if (d==1)
				{

				}
				cout << d + a + 1+h << endl;
				if (a == 2)
				{

				}
				for (b = 0; b <= d; b++)
				{
					cout << "0 ";

				}
				for ( b = 0; b < h; b++)
				{
					cout << "0 ";

				}

				for (b = 0; b < a; b++)
				{
					cout << "1 ";

				}
				cout << endl;




				return 0;
			}
		}
		
	}





	
	return 0;
}
0