为什么老是做不对,感觉都考虑到了,就是50分【可恶】
查看原帖
为什么老是做不对,感觉都考虑到了,就是50分【可恶】
564655
decade21楼主2023/9/24 21:23
#include <bits/stdc++.h>
using namespace std;

int main() {
	int q;
	cin >> q;
	while (q--) {
		long long op, n, x;
		cin >> op >> n >> x;
		if (op == 1 && x == n - 1 || op == 2 && x == n - 1) {
			for (int i = 1; i <= n - 1; i++) {
				cout << 1 << ' ' ;
			}
			cout << endl;
			continue;
		}
		if (op == 1 && x < n - 1 || op == 2 && x < n - 1) {
			cout << -1 << endl;
			continue;
		}
		if (op == 1) {
			for (int i = 1; i <= n - 2; i++) {
				cout << 1 << ' ';
			}
			cout << x - n + 2 << ' ' << x - n + 2 << endl;
		}
		if (op == 2) {
			for (int i = 1; i <= n - 1; i++) {
				cout << 1 << ' ';
			}
			cout << x - n + 2 << endl;
		}
	}
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
	int q;
	cin >> q;
	while (q--) {
		long long op, n, x;
		cin >> op >> n >> x;
		if (op == 1 && x == n - 1 || op == 2 && x == n - 1) {
			for (int i = 1; i <= n - 1; i++) {
				cout << 1 << ' ' ;
			}
			cout << endl;
			continue;
		}
		if (op == 1 && x < n - 1 || op == 2 && x < n - 1) {
			cout << -1 << endl;
			continue;
		}
		if (op == 1) {
			for (int i = 1; i <= n - 2; i++) {
				cout << 1 << ' ';
			}
			cout << x - n + 2 << ' ' << x - n + 2 << endl;
		}
		if (op == 2) {
			for (int i = 1; i <= n - 1; i++) {
				cout << 1 << ' ';
			}
			cout << x - n + 2 << endl;
		}
	}
	return 0;
}
2023/9/24 21:23
加载中...