visual 2022
关于debug和release的区别,
原谅我现在才知道
飞机降落--蓝桥
#include<iostream>
using namespace std;
struct node {int a, b, c;
}q[11];int t, n;bool book[11]; // 标记第 i 架飞机是否降落bool dfs(int num, int last) {if (num == n) return 1;for (int i = 1; i <= n; i++) {if (!book[i] && q[i].a + q[i].b >= last) {book[i] = 1;if (dfs(num + 1, max(last, q[i].a) + q[i].c)){return 1;}book[i] = 0;}}return 0;
}
int main() {cin >> t;while (t--) {memset(book, 0, sizeof(book)); // 不要忘记每组测试样例都恢复一下 book 数组的值cin >> n;for (int i = 1; i <= n; i++) {int a, b, c;cin >> a >> b >> c;q[i].a = a; q[i].b = b; q[i].c = c;}if (dfs(0, 0))cout << "YES\n";elsecout << "NO\n";}return 0;
}