QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#580841#9378. Strange BinarytzwWA 1ms3676kbC++14516b2024-09-22 00:18:142024-09-22 00:18:22

Judging History

你现在查看的是最新测评结果

  • [2024-09-22 00:18:22]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3676kb
  • [2024-09-22 00:18:14]
  • 提交

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++){	
			if(i && i%8==0) cout<<endl;
			cout<<a[i]<<' ';
		}
		cout<<endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3676kb

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)