摘要:#define MAX 110
/*******************************
*大整数的加法
*参数:s1,s2为两个以字符串存储的加数
*返回值:无
*******************************/
char result[MAX];
void big_num_add(char * s1,char * s2)
{ int max_len,len1,len2; int i,k; char * a; char * b; len1 = strlen(s1); len2 = strlen(s2); max_...
阅读全文
摘要:http://poj.org/problem?id=3199/* Author : yan * Question : POJ 3199 Uncle Jack * Date && Time : Friday, February 18 2011 01:45 PM * Compiler : gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3*/#include<stdio.h>#define MAX 30char mul1[MAX];char ans[2*MAX];void multiply(char *a,char *b,char *c){ int i,
阅读全文
摘要:http://poj.org/problem?id=1001WA了三次整数的幂忘记去掉小数点了!!!!!ExponentiationTime Limit:500MSMemory Limit:10000KDescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many compu
阅读全文
摘要:http://poj.org/problem?id=3331The Idiot of the Year Contest!Time Limit:2000MSMemory Limit:65536KTotal Submissions:3072Accepted:1590DescriptionThere is just one basic rule in the Idiot of the Year Contest (IYC)! The contestant picks a random digit between 0 and 9, computes the factorial of the day of
阅读全文
摘要:http://poj.org/problem?id=2389Bull MathTime Limit:1000MSMemory Limit:65536KDescriptionBulls are so much better at math than the cows. They can multiply huge integers together and get perfectly precise answers ... or so they say. Farmer John wonders if their answers are correct. Help him check the bu
阅读全文
摘要:http://poj.org/problem?id=2661Factstone BenchmarkTime Limit:1000MSMemory Limit:65536KDescriptionAmtel has announced that it will release a 128-bit computer chip by 2010, a 256-bit computer by 2020, and so on, continuing its strategy of doubling the word-size every ten years. (Amtel released a 64-bit
阅读全文
摘要:http://poj.org/problem?id=1995Raising Modulo NumbersTime Limit:1000MSMemory Limit:30000KDescriptionPeople are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult mathematical game
阅读全文
摘要:http://poj.org/problem?id=2845、刚刚开始用的转换方法,例子都过了但是总是WA,现在还不清楚哪里的问题然后用了高精度加法AC,但是注意输出的时候前导0和结果为0的情况01000001Time Limit:1000MSMemory Limit:65536KDescriptionAdding binary numbers is a very simple task, and very similar to the longhand addition of decimal numbers. As with decimal numbers, you start by add
阅读全文
摘要:Big NumberTime Limit:1000MSMemory Limit:65536KTotal Submissions:17518Accepted:5541DescriptionIn many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to
阅读全文
摘要:char result[100];void add(char *s1,char *s2){ char a[100],b[100]; int i,Len,Len1,Len2,k; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); memset(result,0,sizeof(result)); Len1=strlen(s1); Len2=strlen(s2); if(Len1>Len2) Len=Len1; else Len=Len2; k=0; for(i=Len1-1;i>=0;i--...
阅读全文
摘要:高手分析:求阶乘末尾0的个数,对于较小的数的话可以计算出来后在算末尾0的个数,但是数字较大的时候则比较麻烦,可以通过如下原理反复的除以5得到最后的结果:原理是: 假如你把1×2×3×4×……×N中每一个因数分解质因数,结果就像: 1 × 2 × 3 × (2 × 2) × 5 × (2 × 3) × 7 × (2 × 2 ×2) ×…… 10进制数结尾的每一个0都表示有一个因数10存在——任何进制都一样,对于一个M进制的数,让
阅读全文