当前位置: 首页 > news >正文

P9241 [蓝桥杯 2023 省 B] 飞机降落

1.10分代码 

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long int
int n;
int a[20], t[20], d[20], l[20];
int dfs(int x, int time) {if (x >= n)return 1;for (int i = 1; i <= n; i++) {if (!a[i] && t[i] + d[i] >= time) {a[i] = 1;int u = max(time, t[i])+l[i];if (dfs(x + 1, u))return 1;a[i] = 0;//回溯}}return 0;
}
void solve() {cin >> n;for (int i = 1; i <= n; i++) {cin >> t[i] >> d[i] >> l[i];}memset(a, 0, sizeof(a));if (dfs(1, -1))cout << "YES" << endl;elsecout << "NO" << endl;}
signed main() {ios::sync_with_stdio(0);cin.tie(0);int t = 1;cin >> t;while (t--)solve();return 0;
}


http://www.mrgr.cn/news/38966.html

相关文章:

  • 【数据治理-设计数据标准】
  • RK3568的型号区分
  • 电瓶车常见电压数据 48v/60v/72v 说明
  • uniapp在线打包的ios后调用摄像头失败的解决方法
  • MetaMap工具深度解析
  • 文档翻译软件哪个好用?高效翻译看这里
  • 雷池 WAF 如何配置才能正确获取到源 IP
  • Meta Quest 3S
  • 普密斯在线图像测量仪:图像与测量的完美结合
  • 【运动控制】关于GPIO通用输入口的锁存功能
  • 各种 JIT(Just-In-Time) 编译器
  • 苏州 工业三维动画制作「世岩清上」一站式可视化营销服务商
  • 【Kubernetes】常见面试题汇总(四十六)
  • 从0学习React(4)---更新组件状态setState
  • STK中计算通信链路的有用链接
  • 【傻呱呱】ESXI挂载USB移动硬盘给黑裙扩容
  • 【GAN】生成对抗网络Generative Adversarial Networks理解摘要
  • 【django】django项目使用https访问+ssl证书
  • 数字人直播屡次违规真相曝光!有哪些技术可以有效解决?
  • 你如何看待音乐倍速播放的问题呢?