上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 51 下一页
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1236题意:中文名。这种排序题已经无力吐槽了。敲错变量tle了一次- -。代码: 1 # include <stdio.h> 2 # include <stdlib.h> 3 # include <string.h> 4 5 6 typedef struct STU{ 7 char name[25] ; 8 int scr ; 9 }STU ;10 11 12 STU stu[1010] ;13 int scr[15] ;14 15 16 int cmp (const 阅读全文
posted @ 2012-04-27 06:32 Seraph2012 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2571题意:中文。mark:水dp。不过边界不太好处理,写成dfs+记忆化比较方便。给2组容易错的数据。应该都输出0。21 2-1 12 1-11代码: 1 # include <stdio.h> 2 3 4 int a[25][1010], vis[25][1010] ; 5 int n, m, INF = 0x0f0f0f0f ; 6 7 8 int max(int a, int b){return a>b?a:b;} 9 10 11 int dfs(int x, int y)12 阅读全文
posted @ 2012-04-27 06:19 Seraph2012 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2570题意:中文。mark:很水的题。体积V都一样,排序后贪心就可以了。各种wa,主要还是浓度计算那儿装逼不想用实数,就用整数绕过去,结果各种想不清楚。代码: 1 # include <stdio.h> 2 # include <stdlib.h> 3 4 5 int p[110] ; 6 7 int cmp(const void *a, const void *b) 8 { 9 return *(int*)a - *(int*) b ;10 }11 12 13 int main 阅读全文
posted @ 2012-04-27 06:04 Seraph2012 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2569题意:中文。mark:水递推。很容易得到方程dp[i] = 2*dp[i-1]+dp[i-2]。不过dp[0] = 3。注意要用long long。代码: 1 # include <stdio.h> 2 3 4 long long dp[45] = {3,3} ; 5 6 7 int main () 8 { 9 int T, n, i ;10 for (i = 2 ; i <= 40 ; i++)11 dp[i] = 2*dp[i-1]+dp[i-2] ;1... 阅读全文
posted @ 2012-04-27 05:45 Seraph2012 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2568题意:中文。mark:看清楚题就好了。就是求二进制表示时1的个数。本来嘛递归直接可以搞,请容我装逼一下用了位运算。。。代码: 1 # include <stdio.h> 2 3 4 int calc(int x){return x?calc(x-(x&-x))+1:0;} 5 6 7 int main () 8 { 9 int T, n ;10 scanf ("%d", &T) ;11 while(T--)12 {13 scanf ("%d 阅读全文
posted @ 2012-04-27 05:33 Seraph2012 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2567题意:中文。没啥好说的。代码: 1 # include <stdio.h> 2 # include <string.h> 3 4 5 int main () 6 { 7 int T, i, len ; 8 char s1[55], s2[55] ; 9 scanf ("%d", &T) ;10 while (T--)11 {12 scanf ("%s%s", s1, s2) ;13 len = strlen(s1) ;14.. 阅读全文
posted @ 2012-04-27 05:28 Seraph2012 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1800题意:士兵要学骑扫帚。每个士兵有一个level,level高的能在同一把扫帚上教level低的怎么骑。一个人最多有一个老师,一个学生。也可以没有。给n个士兵的level值,问最少需要多少扫帚。mark:显然就是找出现次数最多的数字的次数。但因为数字长度多达30个字符,因此long long都存不下,用字符串。wa了一次,忘记处理前导0。代码: 1 # include <stdio.h> 2 # include <string.h> 3 # include <stdli 阅读全文
posted @ 2012-04-27 05:24 Seraph2012 阅读(1097) 评论(0) 推荐(1) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1496题意:给a,b,c,d。计算有多少组(x1,x2,x3,x4)满足方程。mark:这其实是poj1840的Eqs简化成的问题,是一个经典的hash问题,但是poj是对内存限制严格,此题则是对时间卡的更紧,TLE了好多次。首先将等式分成两边,写成a*x1^2+b*x2^2 = - c*x3^2-d*x4^2,然后枚举其中一边的所有值存起来(hash存),再枚举另一边求解。懒得写hash,直接开200w的数组不是不行,但是很容易TLE。千万不能用O(n)的方式清零数组,应该再执行一次存数时的枚举,原来 阅读全文
posted @ 2012-04-11 05:07 Seraph2012 阅读(536) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2094题意:题目说的不清楚,有很多情况都没说到。不过数据很水,只要判断入度为0的点是否只有1个就可以了。代码: 1 # include <stdio.h> 2 # include <string.h> 3 4 5 int cnt ; 6 char tab[2010][100] ; 7 int degree[2010] ; 8 9 10 int find(char a[])11 {12 int i ;13 for (i = 0 ; i < cnt ; i++)14 i... 阅读全文
posted @ 2012-04-11 04:24 Seraph2012 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2093题意:中文。成绩排序。mark:看似复杂,其实就是个排序,考察基本功。代码: 1 # include <stdio.h> 2 # include <string.h> 3 # include <stdlib.h> 4 5 6 typedef struct NODE{ 7 char name[15] ; 8 int num, time ; 9 }NODE ;10 11 12 NODE stu[1010] ;13 14 15 int cmp(const void * 阅读全文
posted @ 2012-04-11 04:14 Seraph2012 阅读(162) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 51 下一页