QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#589725#9378. Strange Binarymanba_outCompile Error//C++201.7kb2024-09-25 19:53:512024-09-25 19:53:52

Judging History

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

  • [2024-09-25 19:53:52]
  • 评测
  • [2024-09-25 19:53:51]
  • 提交

answer

#include <bits/stdc++.h>
#define low(x) ((x) & (-(x) ) )
#define E(x) ((x) * (x))
#define ma make_pair
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;

char ch1;
template<class T>
inline void rd(T& x) {
	x = 0; bool w = 0;
	ch1 = getchar();
	while (!isdigit(ch1)) { ch1 == '-' && (w = 1), ch1 = getchar(); }
	while (isdigit(ch1)) { x = (x << 1) + (x << 3) + (ch1 & 15), ch1 = getchar(); }
	w && (x = (~x) + 1);
}
template<class T>
inline void wr(T x)
{
	if (x < 0) x = -x, putchar('-');
	if (x < 10) {
		putchar(x + 48);
		return;
	}
	T L = x / 10;
	wr(L);
	putchar(x - ((L << 1) + (L << 3)) + 48);
}
/*int head[N],tot;
struct edge{
	int to,nxt;
}e[M];

void add(int u,int v){
	e[++tot].to = v;
	e[tot].nxt = head[u];
	head[u] = tot;
}*/

bool cp(int a,int b){return a > b;} // \xb4\xf3\xb5\xbdС

int gcd(int a,int b){
	if(b == 0)return a;
	return gcd(b,a % b);
}

LL exgcd(LL a, LL b, LL &x, LL &y){
    if(b == 0){
        x = 1, y = 0;
        return a;
    }
    LL d = exgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}

int T;
int ans[32];
void solve(ll n){
	if(n%4==0){
		cout<<"NO\n";
		return;
	}
	cout<<"YES\n";
	bool ok = true;
	per(i,31,0){
		if(ok){
			if(n&(1<<i))ans[i] = 1;
			else{
				ok = false;
				if(i==0)ans[i] = 0;
				else ans[i] = 1;
			}
		}
		else{
			ans[i] = -1
			if(n&(1<<i))ok = true;
		}
	}
	rep(i,0,31){
		cout<<ans[i]<<' ';
		if(i%8==7)cout<<'\n';
	}
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	ll t,n;
	while(t--){
		cin>>n;
		solve(n);
	}
	return 0;
}



詳細信息

answer.code:50:1: error: ‘LL’ does not name a type; did you mean ‘ll’?
   50 | LL exgcd(LL a, LL b, LL &x, LL &y){
      | ^~
      | ll
answer.code: In function ‘void solve(ll)’:
answer.code:79:36: error: expected ‘;’ before ‘if’
   79 |                         ans[i] = -1
      |                                    ^
      |                                    ;
   80 |                         if(n&(1<<i))ok = true;
      |                         ~~