上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 51 下一页
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1804题意:要把输入的英文字符串转化成复数的形式。mark:规则就是那4条。注意y的判断还要满足前一个字符不是元音字母(aeiou)就可以了。代码: 1 # include <stdio.h> 2 # include <string.h> 3 4 5 char dict[25][2][25] ; 6 int n, m ; 7 8 9 int find(char s[])10 {11 int i ;12 for (i = 0 ; i < n ; i++)13 if ... 阅读全文
posted @ 2012-05-03 05:01 Seraph2012 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1978题意:中文。mark:水题。可以dfs搞,也可以dp搞,此处是dp。写错下标wa了1次,忘记删调试信息ole一次。太2了。代码: 1 # include <stdio.h> 2 3 4 # define MOD 10000 5 6 7 int a[110][110], dp[110][110] ; 8 int n, m ; 9 10 11 int calc(int x, int y)12 {13 int i, j, rtn = 0 ;14 if (x == n-1 && 阅读全文
posted @ 2012-05-03 04:45 Seraph2012 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2184题意:中文。。。就是递归了。代码: 1 # include <stdio.h> 2 3 4 int n ; 5 long long m ; 6 7 8 int pil[3][70] ; 9 10 11 void gao(int a[], int b[], int c[])12 {13 long long mid = (1LL << (n-1)) ;14 if (n == 0) return ;15 if (m >= mid)16 {17 c[... 阅读全文
posted @ 2012-05-03 03:35 Seraph2012 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1997题意:中文。。。mark:生生递归就好了。代码: 1 # include <stdio.h> 2 3 4 int num[4] ; 5 int pil[4][70] ; 6 int n ; 7 8 9 int judge(int a[70], int b[70], int c[70], int na, int nb, int nc)10 {11 // printf ("%d\n", n) ;12 if (n == 0) return 1 ;13 if (na < 阅读全文
posted @ 2012-05-03 02:44 Seraph2012 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1992题意:用1*2和2*1的小长方形铺垫4*W的方格有多少种方法。mark:这题真是一个非常有意思的题目,第一眼看,觉得应该是很简单的递推题,但是又秒不掉,灰常让人捉集。首先递推总是想着从后往前由已知解来推出新解。这题很容易想到当W为n的时候,用n-1的结果加上两个竖杠和n-2的结果加上题目分析的那五种中不和n-1重复的4种情况来构造。但是但是但是,这是不完全的。在推导W=3的情况时发现只有9种,然而按题目应该是11种。想了很久才发现漏掉了以下这种情况(由于对称,因此少2种): -- -- --| . 阅读全文
posted @ 2012-05-02 12:53 Seraph2012 阅读(739) 评论(1) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1988题意:n块煎饼,尺寸分别为1至n,从上到下堆成一堆。正面朝上为+,反面朝上为-。每次可以选择上面若干块整个翻转过来。求翻转的步骤,能使得最后正面朝上,尺寸从上到下是小到大。mark:没啥困难的,每次选最大的那个经过不超过3次操作翻到最底下。sample给得很好,主要是注意最顶上1的处理就可以了。代码: 1 # include <stdio.h> 2 3 4 int n, a[35] ; 5 int ans[110], cnt ; 6 7 8 int abs(int x){return 阅读全文
posted @ 2012-05-01 12:22 Seraph2012 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1987题意:就是1986的逆向。。。解码。mark:要注意的是要去掉解码出来的字符串的结尾空格。如果字符串是空串,数字和字符串之间的空格不需要去掉。一直PE,后来发现是去结尾空格的时候,i = len - 1写成了i = len。。。太2了。代码: 1 # include <stdio.h> 2 # include <string.h> 3 4 5 char str[410] ; 6 char out[25][25] ; 7 char ss[100], ssout[110] ; 阅读全文
posted @ 2012-05-01 10:49 Seraph2012 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1986题意:按要求把字母或空格字符串扩展成5个01字符表示的字符串以后,缠绕放置在一个r*c的矩阵里。最后一排一排输出。mark:各种wa。后来才发现是输入的问题。当字符串长度为0的时候,我本来用的是scanf的正则输入,结果事实证明不行。。。另外用来放置扩展以后的字符串的字符数组ss一开始忘记清0也wa了一次。代码: 1 # include <stdio.h> 2 # include <string.h> 3 4 5 char str[100] ; // less than 8 阅读全文
posted @ 2012-04-27 23:03 Seraph2012 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1981题意:给长度为n的小写字母字符串,有3种操作:"Q A":输出当前字符串的第A个字符;"S A B":把第A个到第B个字符都加1。a变成b,b变成c,z变成a。。。"R A B":把从A到B的字符串逆转。输出就是Q操作的时候的输出。mark:这题真是tricky。一看8w个字符,先知道直接搞是肯定不行的。后来想了一下也没想到好办法。查了一下,原来可以记录下每次的操作,然后查询的时候根据位置往前循环,因为查找次数少,因而效率比较高。一开始w 阅读全文
posted @ 2012-04-27 09:05 Seraph2012 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1673题意:一条路上有n家商店,给出坐标。某人停车在某点后,要逛完所有商店回到车出。停车地点自选,求最少需要步行多远。mark:唬人,其实就是最大值与最小值差的两倍。代码: 1 # include <stdio.h> 2 3 4 int main () 5 { 6 int T, n, num ; 7 int max, min ; 8 scanf ("%d", &T) ; 9 while (T--)10 {11 scanf ("%d", & 阅读全文
posted @ 2012-04-27 06:36 Seraph2012 阅读(273) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 51 下一页