QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#745203 | #9378. Strange Binary | JZYZ# | Compile Error | / | / | C++14 | 1.2kb | 2024-11-14 08:15:49 | 2024-11-14 08:15:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
template <typename T>inline void read(T &x)
{
x=0;char c=getchar();bool f=0;
for(;c<'0'||c>'9';c=getchar())f|=(c=='-');
for(;c>='0'&&c<='9';c=getchar())x=(x<<1)+(x<<3)+(c-'0');
x=(f?-x:x);
}
typedef unsigned long long ull;
const int N = 2e5+7;
typedef long long LL;
LL num[N];
int main()
{
// freopen("a.in", "r", stdin);
//freopen("a.ans", "w", stdout);
int t;
read(t);
while(t--)
{
LL n;
read(n);
if(n%4==0)
{
printf("NO\n");
continue;
}
for(int i=0;i<=31;i++)num[i]=0;
printf("YES\n");
for(int i=31;i>=0;i--)
{
LL c=((n>>i)&1);
if(c==1)num[i]=1;
else
{
if(i==0)continue;
int j=i-1;
for(;j&&((n>>j)%2==0);j--);
for(int k=i;k>=j;k--)num[k]=-1;
num[i]=1;
i=j;
}
}
LL x=0;
for(int i=0;i<=31;i++)x+=(1ll<<i)*num[i];
for(int i=0,r=0;i<=31;i++,r=(r+1)%8)
{
printf("%d ",num[i]);
if(r==7)printf("\n");
}
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:49:22: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘LL’ {aka ‘long long int’} [-Wformat=] 49 | printf("%d ",num[i]); | ~^ ~~~~~~ | | | | int LL {aka long long int} | %lld answer.code:53:2: error: expected ‘}’ at end of input 53 | } | ^ answer.code:15:1: note: to match this ‘{’ 15 | { | ^