結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2018-05-19 05:13:59 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 723 bytes |
| コンパイル時間 | 1,625 ms |
| コンパイル使用メモリ | 165,200 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-07 13:56:01 |
| 合計ジャッジ時間 | 2,155 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#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 << "14" << endl;
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;
}
kuuso1