- 博客(58)
- 收藏
- 关注
原创 九度OJ 1462 动态规划变形之《两船载物问题》
题目地址:http://ac.jobdu.com/problem.php?pid=146201背包#include#include#define MAXS 5002int list[102];int dp[MAXS];int max(int a,int b){ return a>b?a:b;}int main(){ int i,j,c1,c2,sum,n; whil
2013-03-17 10:50:30
1361
原创 天勤OJ 1098 大数处理之《N的阶乘》
题目地址:http://www.acmclub.com/problem.php?id=1098#include#include#define MAXS 3002typedef struct E{ int num[MAXS]; int lenth;}E;E ans[1001];E mul(E a,int k){ int i; for(i=0;i<=a.lenth;i++
2013-03-15 19:58:57
956
原创 九度OJ 清华12真题之广度优先搜索之《玛雅密码》
题目地址:http://ac.jobdu.com/problem.php?pid=1482#include#include#include#define MAXS 20using namespace std;bool mark[1594330];int mark2[3];int l,n;typedef struct E{ int h[MAXS]; int num;//映射成
2013-03-12 16:42:26
1217
原创 九度OJ 1463 贪心算法、优先队列、运算符重载之《招聘会》
题目地址:http://ac.jobdu.com/problem.php?pid=1463#include#include#include#include#define MAXS 1002using namespace std;typedef struct E{ int s; int e; bool operator > (E A) const { return e
2013-03-12 10:57:16
1088
原创 九度OJ 教程31 包含结构体的优先队列及运算符重载之《搬水果》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=30很是不容易,终于在各位大神的指导下,会用了……标记一下……希望能帮助到其他人……#include#include#include#define MAXS 1001using namespace std;typedef struct E{ int weight; bool o
2013-03-11 18:45:11
777
原创 九度OJ 1035 09浙大真题之优先队列堆排序之《寻找大富翁》
题目地址:http://ac.jobdu.com/problem.php?pid=1034#include#include#includeusing namespace std;priority_queue Q;int main(){ int money,m,n; while(~scanf("%d %d",&n,&m)&&n) { m=m<n?m:n; while(
2013-03-09 09:05:04
921
原创 九度OJ 08浙大真题之《魔咒词典》
题目地址:http://ac.jobdu.com/problem.php?pid=1029#include#include#include#define MAXS 100002typedef struct E{ char name[22]; char op[82];}E;E dict1[MAXS],dict2[MAXS];int cmp1(const void *a,
2013-03-08 16:27:29
744
原创 九度OJ 1022 07浙大真题之《游船出租》——题目错误,鉴定完毕!
题目地址:http://ac.jobdu.com/problem.php?pid=1022题目叙述,有大问题……很大的问题……冲突数据,竟然得保留前一个??按照后一个来算,竟然是错?可是题目说,冲突数据是由于线路原因造成的啊!俩冲突数据(假设俩S)的中间,必然因为线路漏了一个E!则,为啥要保留前一个数据???…各种想不通……#include#include#define M
2013-03-08 01:18:45
979
原创 清橙OJ A1036.分解质因数
题目地址:http://www.tsinsen.com/ViewGProblem.page?gpid=A1036//清橙OJ A1036.分解质因数//http://www.tsinsen.com/ViewGProblem.page?gpid=A1036#include#include#define MAXS 10005int main(){ int a,b,i,j,k,coun
2013-03-03 23:52:35
1056
原创 清橙OJ A1095 回溯之教室排课
题目地址:http://www.tsinsen.com/ViewGProblem.page?gpid=A1095//清橙OJ A1095 回溯之教室排课//http://www.tsinsen.com/ViewGProblem.page?gpid=A1095#include#includeint room[9]={0,120,40,85,50,100,140,7
2013-03-03 23:15:18
1189
原创 九度OJ 教程103 广搜解决《珍惜现在,感恩生活》之内存超
内存超http://ac.jobdu.com/problem.php?cid=1040&pid=102#include#include#define MAXS 105#include;using namespace std;typedef struct E{ int weight; int rest_money; int nrest[102];/
2013-03-03 12:49:21
706
原创 九度OJ 教程87 广度优先搜索之《非常可乐》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=86//九度OJ 教程87 广度优先搜索之《非常可乐》//http://ac.jobdu.com/problem.php?cid=1040&pid=86#include #define MAXS 110#include #includeusing namespace
2013-03-01 14:04:19
708
原创 九度OJ 教程91 回溯算法之《全排列》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=90//九度OJ 教程91 回溯算法之《全排列》//http://ac.jobdu.com/problem.php?cid=1040&pid=90#include #include#define MAXS 8int mark[MAXS],count,lenth;cha
2013-03-01 12:09:09
1157
1
原创 九度OJ 教程89 递归+回溯之《Prime ring problem》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=88//九度OJ 教程89 递归回溯算法之《Prime ring problem》//http://ac.jobdu.com/problem.php?cid=1040&pid=88#include#include#define MAXS 22int mark[MAXS]
2013-02-27 23:03:18
656
原创 九度OJ 二分求幂法、快速取模之《root(n,k)》
借鉴http://blog.sina.com.cn/s/blog_8619a25801010wcy.html题目地址:http://ac.jobdu.com/problem.php?pid=1085//九度OJ 快速取模之《root(n,k)》//http://ac.jobdu.com/problem.php?pid=1085#includeint k;long fang(long
2013-02-23 08:27:23
779
转载 快速取模运算
转载自http://blog.sina.com.cn/s/blog_8619a25801010wcy.html转载自http://blog.sina.com.cn/s/blog_8619a25801010wcy.htmlmathematics对于程序是很重要的,光会bruteforce是不能提高编程水平的,最近做的上机题目尤其是上交跟清华北大都用到不少相关的东西,巧妙的解决了问题。
2013-02-22 22:43:51
1396
原创 九度OJ 教程99 动态规划之《搬寝室》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=98//九度OJ 教程99 动态规划之《搬寝室》//http://ac.jobdu.com/problem.php?cid=1040&pid=98#include#include#include#define MAXS 2002int min(int a,int b)
2013-02-22 21:03:48
723
原创 九度OJ 教程62 大数处理之《进制转换》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=61//九度OJ 教程62 大数处理之《进制转换》//http://ac.jobdu.com/problem.php?cid=1040&pid=61#include#include#define MAXS 3000typedef struct E{ int num[M
2013-02-21 13:34:48
571
原创 九度OJ 1086 动态规划之《最小花费》——11年清华机试真题
题目地址:http://ac.jobdu.com/problem.php?pid=1086动态规划的处女作就这么ac了……既激动,又激动,还激动……动态规划在真题中所占的比例,不是一般的多啊……可爱的机试,我来了!//九度OJ 1086 动态规划之《最小花费》//http://ac.jobdu.com/problem.php?pid=1086#include#
2013-02-21 11:05:49
1607
原创 九度OJ 1079 清华真题——字符串处理之《手机键盘》
题目地址:http://ac.jobdu.com/problem.php?pid=1079//九度OJ 1079 字符串处理之《手机键盘》//http://ac.jobdu.com/problem.php?pid=1079#include#include#define MAXS 102int main(){ int i,n,l,flag,count; char
2013-02-21 09:42:21
544
原创 九度教程77 dijkstra算法之《单源最短路径》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=76//九度教程77 dijkstra算法之《单源最短路径》//http://ac.jobdu.com/problem.php?cid=1040&pid=76#include#define MAXN 1047483640//typedef struct E{ int min;
2013-02-19 17:50:27
494
原创 九度OJ 教程82 拓扑排序之《产生冠军》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=104//九度OJ 教程82 拓扑排序之《产生冠军》//http://ac.jobdu.com/problem.php?cid=1040&pid=81#include#include#define MAXS 1002char name[MAXS][40];int count;
2013-02-19 10:16:20
562
原创 九度OJ 教程88 递归解决之汉诺塔III
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=87另地址:http://acmclub.com/problem.php?id=1151//九度OJ 教程88 递归解决之汉诺塔III//http://ac.jobdu.com/problem.php?cid=1040&pid=87#includeint main(){ long
2013-02-18 23:51:10
570
原创 九度OJ 教程86 广度优先搜索解决迷宫问题之《胜利大逃亡》
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=85无费地址:http://acmclub.com/problem.php?id=1209 //九度OJ 教程86广度优先搜索迷宫之《胜利大逃亡》//http://ac.jobdu.com/problem.php?cid=1040&pid=85#include#include
2013-02-18 23:25:41
750
原创 九度OJ教程75 kruskal求最小生成树
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=74免费地址:http://acmclub.com/problem.php?id=1145//九度OJ教程75 kruskal求最小生成树之《继续畅通工程》//http://ac.jobdu.com/problem.php?cid=1040&pid=74//Tip:先用qsort
2013-02-18 19:48:39
481
原创 九度OJ 教程56 约数的个数(感谢炮神的约数公式)
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=55//九度OJ 教程56 约数的个数(感谢炮神的约数公式)//http://ac.jobdu.com/problem.php?cid=1040&pid=55//leizh007大神的约数公式,借鉴写的代码,感谢炮神#include #define MAXS 100004int
2013-02-18 18:10:31
659
原创 九度OJ 教程52 素数筛选
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=51//九度OJ 教程52 Prime//http://ac.jobdu.com/problem.php?cid=1040&pid=51#include #define M 120050#define N 12005int mark[M]={0},count=0;long long
2013-02-18 17:03:38
297
原创 九度OJ 教程81 拓扑排序——确立比赛名次
九度题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=80免费题目地址:http://acmclub.com/problem.php?id=1077//九度OJ 教程81 拓扑排序之确立比赛名次//http://ac.jobdu.com/problem.php?cid=1040&pid=80//有向图利用存储矩阵存储,另设一个标记数
2013-02-18 12:35:16
591
原创 九度OJ 教程83 百鸡问题
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=82//九度OJ 教程83 百鸡问题//http://ac.jobdu.com/problem.php?cid=1040&pid=82#include int main(){ int n,x,y,z; while(~scanf("%d",&n)) { n*=3; for(x
2013-02-18 10:58:00
358
原创 九度OJ 教程85 求最大值 木有前兆输入时,的读取数据的方法
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=84//九度OJ 教程85 求最大值 //http://ac.jobdu.com/problem.php?cid=1040&pid=84//木有前兆输入的读法。。。#include int main(){ int n,a,max; while(~scanf("%d",&
2013-02-18 10:46:21
333
原创 九度OJ 1063 清华机试之整数和。
题目地址:http://ac.jobdu.com/problem.php?pid=1063//九度OJ 1063 清华机试之整数和。//http://ac.jobdu.com/problem.php?pid=1063#include #define MAXS 200int main(){ int n,flag,sum; while(~scanf("%d",&n)) {
2013-02-18 10:25:37
429
原创 九度OJ 1072 harsh处理清华机试之邮票面值总和
题目地址:http://ac.jobdu.com/problem.php?pid=1072//九度OJ 1072 harsh 清华机试之邮票面值总和。//http://ac.jobdu.com/problem.php?pid=1072#include #define MAXS 200int main(){ int i,ii,jj,kk,j,k,a[MAXS]={0},sum; f
2013-02-18 10:08:11
333
原创 清橙OJ A1046 加法器
题目链接:http://www.tsinsen.com/A1046//清橙OJ A1046 加法器//http://www.tsinsen.com/A1046#include #include #define MAXS 103int main(){ char h[MAXS]; int i,quan,j,count,sum,ans[MAXS],l; while(~sca
2013-02-18 00:07:30
468
原创 清橙OJ A1035 素数之和
题目地址:http://www.tsinsen.com/A1035//清橙OJ A1035 素数之和//http://www.tsinsen.com/A1035//复习一下那个标记素数的过程。#include #include#define MAXS 1002int mark[MAXS]={0};int prime[MAXS],count=0;int main(){
2013-02-17 21:15:11
713
原创 九度OJ 教程34 (完全二叉树)树的查找
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=33//九度OJ 教程34 树的查找 顺便复习了一下二分求幂法。//http://ac.jobdu.com/problem.php?cid=1040&pid=33#include #define MAXS 1002int fang(int d,int k){ if(k
2013-02-17 20:48:51
472
原创 九度OJ 教程48 最小公倍数
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=47//九度OJ 教程48 最小公倍数//http://ac.jobdu.com/problem.php?cid=1040&pid=47#include int main(){ int a,b; while(~scanf("%d %d",&a,&b)) { s=a*b;
2013-02-17 20:16:42
560
原创 九度OJ 教程47 最大公约数
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=46//九度OJ 教程47 最大公约数//http://ac.jobdu.com/problem.php?cid=1040&pid=46#include int main(){ int a,b; while(~scanf("%d %d",&a,&b)) { wh
2013-02-17 20:14:51
316
原创 九度OJ 教程36 排序二叉树的建立与比较是否相同。
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=35//九度OJ 教程36 排序二叉树的建立与比较是否相同。//http://ac.jobdu.com/problem.php?cid=1040&pid=35#include #include#includetypedef struct tt{ char data; str
2013-02-17 19:34:33
400
原创 九度OJ 教程35 排序二叉树的建立与遍历。
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=34//九度OJ 教程35 排序二叉树的建立与遍历。//http://ac.jobdu.com/problem.php?cid=1040&pid=34#include typedef struct tt{ int data; struct tt *l,*r;}tt,*tp;
2013-02-17 18:31:52
551
原创 九度OJ 教程15 排版类问题之叠筐
题目地址:http://ac.jobdu.com/problem.php?cid=1040&pid=14//九度OJ 教程15 排版类问题之叠筐//http://ac.jobdu.com/problem.php?cid=1040&pid=14#include#includeint main(){ char a[2],ss[82][82]; int i,j,n,x,y,flag;
2013-02-17 17:53:51
413
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人