QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#644342 | #9378. Strange Binary | Scene# | WA | 0ms | 3736kb | C++14 | 1.0kb | 2024-10-16 13:24:51 | 2024-10-16 13:24:51 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int read(){
int ret=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
while( isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch&15);ch=getchar();}
return ret*f;
}
int T,n;
int a[40];
int main(){
T=read();
while(T--){
n=read();
for(int i=0;i<=31;++i) a[i]=0;
for(int i=0;i<=31;++i){
if(n&(1<<i)) a[i]=1;
}
int now=32;
bool flg=1;
while(now){
now--;
if(a[now]!=0) continue;
if(now==0||a[now-1]!=0) continue;
int ed=now-1;
while(ed&&a[ed-1]==0) ed--;
if(ed==0){
flg=0;
break;
}
if(a[ed-1]==1){
a[now]=1;
for(int i=now-1;i>=ed;--i){
a[i]=-1;
}
a[ed-1]=-1;
}else{
a[now]=-1;
for(int i=now-1;i>=ed;--i){
a[i]=1;
}
a[ed-1]=1;
}
now=ed-1;
}
if(!flg){
printf("NO\n");
}else{
for(int i=0;i<=31;++i){
printf("%d",a[i]);
if(i%8==7) putchar('\n');
else putchar(' ');
}
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3736kb
input:
3 0 3 5
output:
NO 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 1 0 -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 Token parameter [name=checker] equals to "1", doesn't correspond to pattern "YES|NO" (test case 3)