85分求助!!!玄关
查看原帖
85分求助!!!玄关
808304
ZhengYuZhe_13楼主2025/7/22 21:57
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
struct money {
	int x, y;
};
bool cmp(money a, money b) {
	return a.y < b.y;
}
int g, n;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	cin >> g;
	while (g--) {
		cin >> n;
		money coin[55];
		for (int i = 1; i <= n; i++) {
			cin >> coin[i].x >> coin[i].y;
		}
		if (n == 1) {
			if (abs(coin[1].x) <= abs(coin[1].y)) {
				cout << "Abletocatch";
			}
			else {
				cout << "Notabletocatch";
			}
			cout << endl;
			continue;
		}
		sort(coin + 1, coin + 1 + n, cmp);
		bool flag = true;
		for (int i = 1; i <= n - 1; i++) {
			if (abs(coin[i].x - coin[i + 1].x) > abs(coin[i].y - coin[i + 1].y)) {
				flag = false;
				break;
			}
		}
		if (flag) cout << "Abletocatch";
		else cout << "Notabletocatch";
		cout << endl;
	}
	return 0;
}

WA了3个点,求助玄关!!

2025/7/22 21:57
加载中...