书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa1590 - IP Networks #include<iostream> unsigned i, m, num, ip[4], ipmax[4], ipmin[4], mask[4]; int cmp(unsigned *a, unsigned *b) {//compare for (int i = 0;i < 4;++i) { if (a[i] <…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,10 ms) //UVa508 - Morse Mismatches #include<iostream> #include<string> #include<map> using namespace std; map<char, string> morse; map<string, string> word; string wo, tra…
题意:在前100000个Fibonacci(以下简称F)数字里,能否在这100000个F里找出以某些数字作为开头的F.要求找出下标最小的.没找到输出-1. 代码:(Accepted,0.250s) //UVa12333 - Revenge of Fibonacci //Accepted 0.250s //#define _XIENAOBAN_ #include<iostream> #include<cstring> #define MAXS 0xffffff #define CIN…
题意:模拟客服MM,一共有N种话题,每个客服MM支持处理其中的i个(i < N),处理的话题还有优先级.为了简化流程方便出题,设每个话题都是每隔m分钟来咨询一次.现知道每个话题前来咨询的时间.间隔.处理此话题所需的时长与一共有多少次咨询.问多少时间后全部话题处理完成. 代码:(Accepted,0.010s) //UVa822 - Queue and A //Accepted 0.010s //#define _XIENAOBAN_ #include<algorithm> #includ…
题意:模拟Petri网的执行.虽然没听说过Petri网,但是题目描述的很清晰. 代码:(Accepted,0.210s) //UVa804 - Petri Net Simulation //Accepted 0.210s //#define _XIENAOBAN_ #include<iostream> #include<map> using namespace std; struct { map<int, int> ipt, opt; } Trans[111]; int…
题意:二叉树代表使得平衡天平,修改最少值使之平衡. 代码:(Accepted,0.030s) //UVa12166 - Equilibrium Mobile //Accepted 0.030s //#define _XIENAOBAN_ #include<cstdio> #include<cstring> #include<map> int T; int total; std::map<long long, int> leaf; void build(int…
这三题比较简单,只放代码了. 题目:6-1 UVa673 - Parentheses Balance //UVa673 - Parentheses Balance //Accepted 0.000s //#define _XIENAOBAN_ #include<iostream> using namespace std; int N; char line[130]; bool st[130]; bool cal() { if (*line == '\0') return true; auto…
题意:模拟患者做手术. 其条件为:医院有Nop个手术室.准备手术室要Mop分钟,另有Nre个恢复用的床.准备每张床要Mre分钟,早上Ts点整医院开张,从手术室手术完毕转移到回复床要Mtr分钟.现在医院早上开张了,给你一张患者的表,有Npa个患者等着做手术,每个患者的的信息有:名字.做手术需要的时间.恢复需要的时间.只要有空的手术室位就安排患者进去,优先安排门牌号低的.若多人同时竞争,输入列表靠前的先进.进入恢复室的优先顺序是,也是优先安排床号靠前的床,同时做完手术的人按照手术室的门牌号小的 (很…
题意:对比新老字典的区别:内容多了.少了还是修改了. 代码:(Accepted,0.000s) //UVa12504 - Updating a Dictionary //#define _XieNaoban_ #include<iostream> #include<sstream> #include<string> #include<vector> #include<map> using namespace std; int T; int mai…
题意:不难理解,照搬题意的解法. 代码:(Accepted,0.190s) //UVa1597 - Searching the Web //#define _XIENAOBAN_ #include<iostream> #include<sstream> #include<cstring> #include<string> #include<vector> #include<map> #include<set> using…