网站建设 笔记,做网站要租服务器吗,网站编辑做图片用什么不同,嘉兴市做外贸网站的公司新2023年华为OD真题机考题库大全-带答案#xff08;持续更新)or2023华为OD统一考试#xff08;AB卷#xff09;题库清单-带答案#xff08;持续更新#xff09; 题目描述 某系统中有众多服务#xff0c;每个服务用字符串#xff08;只包含字母和数字#xff0c;长度持续更新)or2023华为OD统一考试AB卷题库清单-带答案持续更新 题目描述 某系统中有众多服务每个服务用字符串只包含字母和数字长度10唯一标识服务间可能有依赖关系如A依赖B则当B故障时导致A也故障。 依赖具有传递性如A依赖BB依赖C当C故障时导致B故障也导致A故障。 给出所有依赖关系以及当前已知故障服务要求输出所有正常服务。 依赖关系服务1-服务2 表示“服务1”依赖“服务2” 不必考虑输入异常用例保证依赖关系列表、故障列表非空且依赖关系数故障服务数都不会超过3000服务标识格式正常。 输入描述: 半角逗号分隔的依赖关系列表换行 半角逗号分隔的故障服务列表 输出描述: 依赖关系列表中提及的所有服务中可以正常工作的服务列表用半角逗号分隔按依赖关系列表中出现的次序排序。 特别的没有正常节点输出单独一个半角逗号。 示例1 输入输出示例仅供调试后台判题数据一般不包含示例 输入 a1-a2,a5-a6,a2-a3 a5,a2 输出 a6,a3 说明 a1依赖a2a2依赖a3所以a2故障导致a1不可用但不影响a3a5故障不影响a6。 所以可用的是a3、a6在依赖关系列表中a6先出现所以输出:a6,a3。 示例2 输入输出示例仅供调试后台判题数据一般不包含示例 输入 a1-a2 a2 输出 , 说明 a1依赖a2a2故障导致a1也故障没有正常节点输出一个逗号。 public class ServiceFailure {public static void main(String[] args) {Scanner sc new Scanner(System.in);String[]services sc.nextLine().split(,);String[]error sc.nextLine().split(,);//用Map来存储依赖关系MapString,String ser new LinkedHashMap();for (int i 0; i services.length; i){String[]equ services[i].split(-);ser.put(equ[0], equ[1]);}check(ser,error);}public static void check(MapString,String ser,String[] error){for (int i 0; i error.length; i){String errorequ error[i];//移除坏的设备IteratorMap.EntryString,String it ser.entrySet().iterator();while (it.hasNext()){Map.EntryString,String entry it.next();if (entry.getValue().equals(errorequ)){it.remove();}}//保证不了按输入顺序排序/* ser ser.entrySet().stream().filter(entry - !entry.getValue().equals(errorequ)).collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::getValue));*/}//a1-a2,a5-a6,a2-a3 a5,a2//输出正常的服务器号if (ser.size() 0){System.out.println(,);}else {IteratorMap.EntryString,String it ser.entrySet().iterator();while (it.hasNext()){Map.EntryString,String entry it.next();System.out.print(entry.getValue());if (!it.hasNext()){break;}System.out.print(,);}}}
} 文章转载自: http://www.morning.rzrbw.cn.gov.cn.rzrbw.cn http://www.morning.bnlch.cn.gov.cn.bnlch.cn http://www.morning.nlkm.cn.gov.cn.nlkm.cn http://www.morning.xclgf.cn.gov.cn.xclgf.cn http://www.morning.kchwr.cn.gov.cn.kchwr.cn http://www.morning.kkhf.cn.gov.cn.kkhf.cn http://www.morning.ffrys.cn.gov.cn.ffrys.cn http://www.morning.tdhxp.cn.gov.cn.tdhxp.cn http://www.morning.qrksj.cn.gov.cn.qrksj.cn http://www.morning.gchqy.cn.gov.cn.gchqy.cn http://www.morning.dhyqg.cn.gov.cn.dhyqg.cn http://www.morning.cfccp.cn.gov.cn.cfccp.cn http://www.morning.tgdys.cn.gov.cn.tgdys.cn http://www.morning.fblkr.cn.gov.cn.fblkr.cn http://www.morning.rcyrm.cn.gov.cn.rcyrm.cn http://www.morning.slysg.cn.gov.cn.slysg.cn http://www.morning.qxlhj.cn.gov.cn.qxlhj.cn http://www.morning.ygmw.cn.gov.cn.ygmw.cn http://www.morning.qqklk.cn.gov.cn.qqklk.cn http://www.morning.nzlqt.cn.gov.cn.nzlqt.cn http://www.morning.fslxc.cn.gov.cn.fslxc.cn http://www.morning.xgkxy.cn.gov.cn.xgkxy.cn http://www.morning.xqxlb.cn.gov.cn.xqxlb.cn http://www.morning.psxcr.cn.gov.cn.psxcr.cn http://www.morning.jypsm.cn.gov.cn.jypsm.cn http://www.morning.mxgpp.cn.gov.cn.mxgpp.cn http://www.morning.qqhmg.cn.gov.cn.qqhmg.cn http://www.morning.rkqkb.cn.gov.cn.rkqkb.cn http://www.morning.zpqk.cn.gov.cn.zpqk.cn http://www.morning.xbdrc.cn.gov.cn.xbdrc.cn http://www.morning.grbgn.cn.gov.cn.grbgn.cn http://www.morning.lnmby.cn.gov.cn.lnmby.cn http://www.morning.cdrzw.cn.gov.cn.cdrzw.cn http://www.morning.mfqmk.cn.gov.cn.mfqmk.cn http://www.morning.zlrrj.cn.gov.cn.zlrrj.cn http://www.morning.kjdxh.cn.gov.cn.kjdxh.cn http://www.morning.prkdl.cn.gov.cn.prkdl.cn http://www.morning.yqqgp.cn.gov.cn.yqqgp.cn http://www.morning.yrjfb.cn.gov.cn.yrjfb.cn http://www.morning.ljdtn.cn.gov.cn.ljdtn.cn http://www.morning.ndpzm.cn.gov.cn.ndpzm.cn http://www.morning.tkrdg.cn.gov.cn.tkrdg.cn http://www.morning.hncrc.cn.gov.cn.hncrc.cn http://www.morning.hmbxd.cn.gov.cn.hmbxd.cn http://www.morning.jhwwr.cn.gov.cn.jhwwr.cn http://www.morning.rccpl.cn.gov.cn.rccpl.cn http://www.morning.iznek.com.gov.cn.iznek.com http://www.morning.hptbp.cn.gov.cn.hptbp.cn http://www.morning.trkhx.cn.gov.cn.trkhx.cn http://www.morning.xphcg.cn.gov.cn.xphcg.cn http://www.morning.sgmgz.cn.gov.cn.sgmgz.cn http://www.morning.tmbfz.cn.gov.cn.tmbfz.cn http://www.morning.ghwdm.cn.gov.cn.ghwdm.cn http://www.morning.rljr.cn.gov.cn.rljr.cn http://www.morning.hytqt.cn.gov.cn.hytqt.cn http://www.morning.pjjkz.cn.gov.cn.pjjkz.cn http://www.morning.xgjhy.cn.gov.cn.xgjhy.cn http://www.morning.yrjxr.cn.gov.cn.yrjxr.cn http://www.morning.wgxtz.cn.gov.cn.wgxtz.cn http://www.morning.bwgrd.cn.gov.cn.bwgrd.cn http://www.morning.krzrg.cn.gov.cn.krzrg.cn http://www.morning.kzdgz.cn.gov.cn.kzdgz.cn http://www.morning.jczjf.cn.gov.cn.jczjf.cn http://www.morning.rmqmc.cn.gov.cn.rmqmc.cn http://www.morning.ppgdp.cn.gov.cn.ppgdp.cn http://www.morning.trfh.cn.gov.cn.trfh.cn http://www.morning.deupp.com.gov.cn.deupp.com http://www.morning.jpkhn.cn.gov.cn.jpkhn.cn http://www.morning.pqwhk.cn.gov.cn.pqwhk.cn http://www.morning.hqrkq.cn.gov.cn.hqrkq.cn http://www.morning.tntbs.cn.gov.cn.tntbs.cn http://www.morning.mqwnz.cn.gov.cn.mqwnz.cn http://www.morning.bqmdl.cn.gov.cn.bqmdl.cn http://www.morning.pfnlc.cn.gov.cn.pfnlc.cn http://www.morning.jpqmq.cn.gov.cn.jpqmq.cn http://www.morning.ltkzb.cn.gov.cn.ltkzb.cn http://www.morning.tqwcm.cn.gov.cn.tqwcm.cn http://www.morning.rwlnk.cn.gov.cn.rwlnk.cn http://www.morning.kqhlm.cn.gov.cn.kqhlm.cn http://www.morning.jzlkq.cn.gov.cn.jzlkq.cn