#3,5,8WA谁懂
查看原帖
#3,5,8WA谁懂
181508
_ygj楼主2023/2/16 19:47

WA#3,5,8 求救

#include <iostream>
#include <cstdio>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <climits>
#include <algorithm>
#include <cstring>
#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;} // 大到小

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

int T,n,m,K;

int pop(int x){
	int pos,i = 0;
	while(x){
		if(x & 1)pos = i;
		x >>= 1;
		i++;
	} 
	return pos;
}


int main(){
	rd(T);
	while(T--){
		rd(n),rd(K),rd(m);
		int c1 = pop(K),c2 = pop(m);
		if(c1 > c2){
			printf("-1\n");
		}
		else if(K > m){
			if(n == 1)printf("-1\n");
			else {
				int cnt = (1ll << c1);
				printf("%d %d",cnt,K - cnt);
				rep(i,3,n)printf(" 0");
				printf("\n");
			}		
		}
		else {	
			printf("%d",K);
			rep(i,2,n)printf(" 0");
			printf("\n");
		}
	}
	return 0;
}

2023/2/16 19:47
加载中...