书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 题目:算法竞赛入门经典 3-4/UVa11809:Floating-Point Numbers 代码: //UVa11809 - Floating-Point Numbers #include<iostream> #include<sstream> #include<cmath> long long E[12][33], e; double M[12][33], m, re; char s…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO(我也是在网上找到的pdf,但不记得是从哪里搜刮到的了,就重新上传了一遍) PS:第一次写博客分享我的代码,不知道我对csdn的使用姿势对不对.想不出来要说些什么哈o(^▽^)o,那就直接开工,先写一篇试试. 题目:算法竞赛入门经典 3-1/UVa1585:Score 代码: #include<iostream> #define MAX 83 int main() { int num; std::cin >&…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 都是<算法竞赛入门经典(第二版)>的题目,标题上没写(第二版) 题目:算法竞赛入门经典 3-7/UVa1368:DNA Consensus String 代码: //UVa1368 - DNA Consensus String #include<iostream> using namespace std; #define MAX_M 52 #define MAX_N 1005 char DNA[MAX…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 题目:算法竞赛入门经典 3-4/UVa455:Periodic Strings 代码: //UVa455 #include<iostream> int main() { char str[82]; int num; std::cin >> num; while (num--) { std::cin>>str; char *ps = str; while (*++ps != '\0') {…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 题目:算法竞赛入门经典 3-10/UVa1587:Box 代码: //UVa1587 - Box #include<iostream> unsigned rect[6];//每个面各有一个一样的对应面,故12个边只要定义6个,其中每偶奇两个代表一个长方形的两个边长 bool flag, times[3];//每个面出现的次数(出现第二次时为true) unsigned tmpx, tmpy, now; int m…
书上具体所有题目: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…
题意:二叉树代表使得平衡天平,修改最少值使之平衡. 代码:(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个患者等着做手术,每个患者的的信息有:名字.做手术需要的时间.恢复需要的时间.只要有空的手术室位就安排患者进去,优先安排门牌号低的.若多人同时竞争,输入列表靠前的先进.进入恢复室的优先顺序是,也是优先安排床号靠前的床,同时做完手术的人按照手术室的门牌号小的 (很…