摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1047这题,,,,只是简单的大数相加,只要模拟小学时候算术就可以了,首先,个位对齐,接着,逐个相加,最后进位,其实相对应的减法也是如此,这题还有一个坑,就是要注意首位0的情况。。。。。#include<stdio.h>#include<string.h>int sum[300];int main(){ int t,i,j,max; char s[300]; scanf("%d",&t); gets(s); while(t--) { for(i=0;i< 阅读全文
posted @ 2013-05-18 12:52 执着追求的IT小小鸟 阅读(187) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2352从字串的最后找起,如果这一个所代表的数字比上一个大,就加上,小的话就减掉。#include<stdio.h>#include<string.h>int main(){ int len,i,t,sum[100],a; char s[200]; sum['I']=1; sum['V']=5; sum['X']=10; sum['L']=50; sum['C']=100; sum['D']= 阅读全文
posted @ 2013-05-18 10:21 执着追求的IT小小鸟 阅读(129) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1708题意就是把两个串当做初始串,像斐波那契数列那样连接起来,然后计算第N个串各个字母出现的次数,思路是运用斐波那契数列思想,计算得,当N为0时,是第一个串,1时就是第二个串,三个以上的,就是串1对应f[n-2],串2对应f[n-1],然后逐个叠加#include<stdio.h>int main(){ int f[55],i,str1[200],str2[200],n,l; char s1[50],s2[50]; f[0]=f[1]=1; for(i=2;i<=50;i++) ... 阅读全文
posted @ 2013-05-18 10:01 执着追求的IT小小鸟 阅读(148) 评论(0) 推荐(0) 编辑