样例过了,but一交就爆0,听说很多细节bushi
  • 板块P9687 Maps.
  • 楼主sugawara
  • 当前回复7
  • 已保存回复7
  • 发布时间2023/10/2 23:02
  • 上次更新2023/11/2 16:25:56
查看原帖
样例过了,but一交就爆0,听说很多细节bushi
776337
sugawara楼主2023/10/2 23:02
#include<iostream>
#include<cstring>
using namespace std;
const int N=1e6;
int m,n,t,p;
int main(){
	scanf("%d",&t);
	for(int j=1;j<=t;j++){
		scanf("%d%d",&n,&p);
		if(p>=(n-1)/2+1 and p>=n/2-1) printf("-1");
		//向上取整 
		else{
			int cloth[n+10],op=n;
			for(int i=1;i<=p;i++){
				cloth[op]=1;
				cloth[--op]=0;
				cloth[--op]=1;
			}
			for(int i=1;i<=n;i++){
				if(cloth[i]==1) printf("1");
				else printf("0");
			}
		}
		printf("\n");
	}
	return 0;
}
2023/10/2 23:02
加载中...