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

亿恩 网站备案做网站vpn多大内存

亿恩 网站备案,做网站vpn多大内存,免费搭建个人网页,wordpress登录缓存题目描述 N 架飞机准备降落到某个只有一条跑道的机场。其中第 i 架飞机在 Ti 时刻到达机场上空#xff0c;到达时它的剩余油料还可以继续盘旋 Di 个单位时间#xff0c;即它最早可以于 Ti 时刻开始降落#xff0c;最晚可以于 Ti Di 时刻开始降落。降落过程需要 Li个单位时间…题目描述 N 架飞机准备降落到某个只有一条跑道的机场。其中第 i 架飞机在 Ti 时刻到达机场上空到达时它的剩余油料还可以继续盘旋 Di 个单位时间即它最早可以于 Ti 时刻开始降落最晚可以于 Ti Di 时刻开始降落。降落过程需要 Li个单位时间。 一架飞机降落完毕时另一架飞机可以立即在同一时刻开始降落但是不能在前一架飞机完成降落前开始降落。 请你判断 N 架飞机是否可以全部安全降落。 输入格式 输入包含多组数据。 第一行包含一个整数 T代表测试数据的组数。 对于每组数据第一行包含一个整数 N。 以下 N 行每行包含三个整数TiDi 和 Li。 输出格式 对于每组数据输出 YES 或者 NO代表是否可以全部安全降落。 样例输入 2 3 0 100 10 10 10 10 0 2 20 3 0 10 20 10 10 20 20 10 20 样例输出 YES NO 提示 对于第一组数据可以安排第 3 架飞机于 0 时刻开始降落20 时刻完成降落。安排第 2 架飞机于 20 时刻开始降落30 时刻完成降落。安排第 1 架飞机于 30 时刻开始降落40 时刻完成降落。 对于第二组数据无论如何安排都会有飞机不能及时降落。 对于 30% 的数据N ≤ 2。 对于 100% 的数据1 ≤ T ≤ 101 ≤ N ≤ 100 ≤ Ti , Di , Li ≤ 105。 import java.util.*; public class Main { static final int N 10; static boolean[] st new boolean[N]; static int n; static boolean flag false; static int[] t new int[N]; static int[] d new int[N]; static int[] l new int[N]; static void dfs(int u, int last) { if (flag) return; // If we found one valid sequence, return if (u n) { // All planes have landed flag true; return; } for (int i 0; i n; i) { if (!st[i]) { // If the current plane hasnt landed yet if (t[i] d[i] last) { // Check if it can wait for the last plane to land st[i] true; // Mark the plane as landed if (t[i] last) { // If this plane arrives after the last one has landed dfs(u 1, t[i] l[i]); // Update last to arrival landing time } else { // If this plane arrives before or when the last one is landing dfs(u 1, last l[i]); // Wait for the last plane to land } st[i] false; // Backtrack } else { return; // If it cant wait, return } } } } public static void main(String[] args) { Scanner scanner new Scanner(System.in); int T scanner.nextInt(); while (T-- 0) { n scanner.nextInt(); for (int i 0; i n; i) { t[i] scanner.nextInt(); d[i] scanner.nextInt(); l[i] scanner.nextInt(); } for (int i 0; i N; i) { st[i] false; // Reset the landing status } flag false; // Reset the flag dfs(0, 0); // Start DFS if (flag) { System.out.println(YES); } else { System.out.println(NO); } } } }import java.util.*;public class Main {static boolean flagfalse;static boolean[] st;static int n;static MapInteger,int[] map;//static Scanner cin new Scanner(System.in);public static void main(String[] args){int t cin.nextInt();while(t--!0)solve();}private static void solve() {n cin.nextInt();flagfalse;//标记如果为true则搜素到答案stnew boolean[n];//初始胡标记数组标记数组用于查询未安排下降的飞机如果标记数组全为true则代表能成功全部安排mapnew HashMap();for (int i 0; i n; i) {//输入int t cin.nextInt();int d cin.nextInt();int l cin.nextInt();map.put(i,new int[]{t,d,l});}for (int i0;in;i){//枚举第一架飞机安排st[i]true;//标记搜索dfs(map.get(i)[0]map.get(i)[2]);//搜索下一驾飞机应该安排什么并把时间传入下一个dfs时间为飞机起飞时间加下降时间st[i]false;//还原取消标记}if(flag) System.out.println(YES);if(!flag) System.out.println(NO);}private static void dfs(int time) {boolean oktrue;//下面for循环中如果没有再安排飞机则代表已经成功安排所有飞机for (int i0;in;i){//枚举飞机if(st[i])continue;//如果已经下降了不用再安排下降okfalse;if(timemap.get(i)[0]map.get(i)[1])continue;int isMath.max(time,map.get(i)[0])map.get(i)[2];//时间取当前时间和飞机起飞时间最大那个加上飞机下降时间st[i]true;//标记dfs(is);//搜索下一驾飞机st[i]false;//还原标记}if(ok)//代表搜素到答案 直接返回flagtrue;return;} }
http://www.w-s-a.com/news/263625/

相关文章:

  • 网站建设推广好做吗黄浦企业网站制作
  • 怎样做28网站代理中山网站建设方案外包
  • vs2010做网站前台搭建小网站
  • 做视频必须知道的一些网站wordpress 标签鼠标滑过_弹出的title 代码美化
  • 怎么做室内设计公司网站电商运营培训视频课程
  • 昆明网站策划天津市建筑信息平台
  • 三亚放心游app官方网站wordpress 个人主题
  • 做简单的网站备案平台新增网站
  • 中国建设网站银行网络营销推广方案整合
  • 网站域名列表dede网站白屏
  • 站长工具一区品牌建设卓有成效
  • 电子商务网站建设案例wordpress批量编辑
  • 想代理个网站建设平台100个最佳市场营销案例
  • 钟表东莞网站建设石家庄做网站时光
  • 织梦 图片网站源码成都建设工程安监局网站
  • 做兼职的网站策划书湖北省建设工程造价信息网
  • 企业网站网址长期做网站应该购买稳定的空间
  • 网站静态化设计html5手机网站制作
  • 深圳最简单的网站建设家居网站建设全网营销
  • 如何取消网站备案佛山网站优化公司
  • 网站开发 成都广水网站设计
  • 音乐网站建设目标合同管理系统
  • jq网站特效插件如何知道网站是否被k
  • 自己的网站怎么接广告网站搭建收费
  • 宁波大型网站制作建立一个网站 优帮云
  • 大连零基础网站建设教学电话有哪些比较好的做ppt好的网站
  • 哪个网站做logo设计我的建筑网
  • php电子商务网站开发沂源手机网站建设公司
  • html和php做网站哪个好3gcms企业手机网站整站源码asp
  • 网站建设网页设计案例云南建设厅网站删除