QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#595405 | #9378. Strange Binary | piaoyun# | WA | 0ms | 3584kb | C++14 | 960b | 2024-09-28 13:38:41 | 2024-09-28 13:38:42 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
int N;
int a[34];
void prepare(){
cin >> N;
if(N == 0){
cout << "NO" << "\n";
return;
}
for(int i = 31; i >= 0; i--){
if(N & (1ll << i)){
a[i] = 1;
}
}
for(int i = 31; i >= 1; i--){
if(a[i] == 0 && a[i-1] == 0){
a[i] = 1;
a[i-1] = -1;
int pnt = i - 2;
while(pnt >= 0){
if(a[pnt] == 1){
a[pnt] = -1;
break;
}
else a[pnt] = -1;
pnt--;
}
}
}
cout << "YES" << '\n';
for(int i = 0; i <= 31; i++){
cout << a[i] << " ";
if(i % 8 == 7) cout << "\n";
}
}
signed main(){
ios::sync_with_stdio(false);
int T;
cin >> T;
while(T--){
prepare();
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3584kb
input:
3 0 3 5
output:
NO YES 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 YES 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1
result:
wrong answer Offend Limitation 3. (test case 3)