結果

問題 No.688 E869120 and Constructing Array 2
ユーザー fura
提出日時 2020-05-05 06:15:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 344 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 191,036 KB
最終ジャッジ日時 2025-01-10 06:42:14
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         lint k; scanf("%lld",&k);
      |                 ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	lint k; scanf("%lld",&k);

	for(lint n=1;n<=30;n++) for(lint m=0;m<=30;m++) if(n+m<=30 && n*(n-1)/2*(1<<m)==k) {
		printf("%lld\n",n+m);
		rep(i,n+m) printf("%d%c",i<n?1:0,i<n+m-1?' ':'\n');
		return 0;
	}

	return 0;
}
0