弱爆了的蒟蒻前三个点WA,玄关求调教
  • 板块P9687 Maps.
  • 楼主hyy114514
  • 当前回复10
  • 已保存回复10
  • 发布时间2023/10/2 20:10
  • 上次更新2023/11/2 16:28:47
查看原帖
弱爆了的蒟蒻前三个点WA,玄关求调教
796919
hyy114514楼主2023/10/2 20:10

rt,这题不会真的退役吧

#include <bits/stdc++.h>

using namespace std;

int t;
int n, p;

void dfs(int x, int k) {
	if (x / 2 < k) {
		cout << "-1" << endl;
		return ;
	}
	if (k == 0) {
		for (int i = 1; i <= x; i++) {
			cout << "0" ;
		}
		cout << endl;
		return ;
	}
	for (int i = 1; i <= x - 3 - (k - 1) * 2; i++) {
		cout << 0;
	}
	for (int i = 1; i <= k; i++) {
		cout << 1 << 0;
	}
	cout << 1 << endl;
	return ;
}

int main() {
	ios::sync_with_stdio(false);
	cin >> t;
	while (t--) {
		cin >> n >> p;
		dfs(n, p);
	}
	return 0;
}//呜呜呜,帮帮萌新
 
2023/10/2 20:10
加载中...