QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#580832 | #9378. Strange Binary | tzw | WA | 1ms | 3620kb | C++14 | 515b | 2024-09-22 00:15:43 | 2024-09-22 00:15:45 |
Judging History
answer
#include<iostream>
using namespace std;
int a[40];
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int k=1;
for(int i=0;i<32;i++){
if(k&n) a[i]=1;
else a[i]=0;
k<<=1;
}
if(a[0]==0 && a[1]==0){
cout<<"NO"<<endl;
continue;
}
cout<<"YES"<<endl;
for(int i=0;i<32;i++){
if(a[i]==1 && a[i+1]==0){
a[i]=-1;
a[i+1]=1;
}
}
for(int i=0;i<32;i++){
cout<<a[i]<<' ';
if(i && i%8==0) cout<<endl;
}
cout<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3620kb
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)