上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: Problem Description假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值#includeint c1[51],c2[51];int main(){ int a[27],n,i,j,k,count; scanf("%d",&n); while(n--) { count=0; memset(c1,0,sizeof(c1)); memset(c2,0,sizeof(c2)); f... 阅读全文
posted @ 2013-12-16 09:44 段少 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 这好像第三次巩固母函数了,第一次没理解思想,第二次理解了,但不知变通,这次总算是弄得挺清楚了。这里写一个模板吧!以及个人对母函数的理解下面以整数划分数的数量为例写的一个模板。#include#includeint c1max],c2[max];//c1保存整数课划分的数目//c2是中间量,保存每一次的情况int main(){ int n,i,j,k; while(scanf("%d",&n)!=EOF) { for(i=0;i<=n;i++)//首先对c1初始化,由第一个表达式(1+x+x^2+..x^n)初始化,把质量从0到n的所有砝码都初始化为1. .. 阅读全文
posted @ 2013-12-15 11:38 段少 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionPeople in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ..., and 289-credit coins, are available in Silverland 阅读全文
posted @ 2013-12-15 00:39 段少 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 问题描述:“Given some Chinese Coins (硬币) (three kinds-- 1, 2, 5), and their number is num_1, num_2 and num_5 respectively, please output the minimum value that you cannot pay with given coins.”这是一道基本的母函数应用题。#include#includeint c1[8010],c2[8010];int main(){ int a,b,c,sum,a1[4]={2,5},i,j,k; while(sca... 阅读全文
posted @ 2013-12-14 23:35 段少 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Problem Description"Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says."The second problem is, given an positive integer N, we define an equation like this:N=a[1]+a[2]+a[3]+...+a[m];a[i]>0,1#includeint c1[121],c2[121];int mai 阅读全文
posted @ 2013-12-13 23:13 段少 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 问题描述:一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?此题比较简单。直接一一比对。#include#includechar s1[1001],s2[1001];int main(){ int i,j,m,n,k; while(scanf("%s",s1)!=EOF) { if(s1[0]=='#') break; scanf("%s",s2); m=strlen(s1);n=strlen(s2); j=0;k=0; ... 阅读全文
posted @ 2013-12-13 17:35 段少 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目描述:输入两个正整数A,B,计算A * B输出结果输入:输入包含多行,第一行表示测试数目,以后每行包含两个正整数A,B(A,B的位数小于200位)输出:针对每一行输入,输出一行代表A*B的结果此题是一个高精度问题,采取的算法是模拟乘法过程。用到字符三个数组。s1,s2用来接收A,B的值,S3用来存取结果。S3从数组下标最大开始存。代码如下:#include#include#includechar s1[201],s2[201],s3[401];int main(){ int i,j,n,k1,k2,k,t,d,m; scanf("%d",&n); while(n 阅读全文
posted @ 2013-12-13 12:01 段少 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 此题的思路是模拟加法运算的过程,首先用s1,s2两个字符串数组接受两个大数。再将其转化为数字。s3数组保存加法之后的数字。注意输出时除去前导0 ,代码如下:#include#includeint main(){ void zhuan(int ,int ,char s1[],char s2[],char s[]); char s1[1001],s2[1001],s[1001]; int i,a,b,t,j; memset(s1,0,sizeof(s1)); memset(s2,0,sizeof(s2)); scanf("%d",&t);getchar(); ... 阅读全文
posted @ 2013-12-12 23:29 段少 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 由N(1 #includeint main(){ char s1[27],s2[27],s3[27];//s3为辅助栈 int n,top,i,k,j; scanf("%d",&n); while(n--) { top=-1; scanf("%s%s",s1,s2); k=strlen(s1); j=0; for(i=0;i-1) top--; else for(;j<k;j++) if(s2[i]!=s1[j])... 阅读全文
posted @ 2013-12-11 23:06 段少 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Problem Description2007年到来了。经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列(f[0]=0,f[1]=1;f[i] = f[i-1]+f[i-2](i>=2))的值全部给背了下来。接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来,不过有的数字太长了。所以规定超过4位的只要说出前4位就可以了,可是CodeStar自己又记不住。于是他决定编写一个程序来测验zouyu说的是否正确。这题要用到对数和斐波那契数列公式Input输入若干数字n(0 #includeint main(){ int f 阅读全文
posted @ 2013-08-22 11:35 段少 阅读(188) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页