摘要: #include<stdio.h>#include<string.h>char c[2000];//全局变量,存储大数运算的结果char arr[1000];//高精度除以高精度的余数long z=0;//高精度除以低精度的余数int Judge(char ch[]){//判断字符串ch是否全为,若全为,返回,否则返回 int i,k; k=strlen(ch); for(i=0;i<k;i++) if(ch[i]!='0') return 0; return 1;}int Compare(char a[],char b[]){//比较字符串的大小 阅读全文
posted @ 2011-11-20 11:45 弄月吟风 阅读(2564) 评论(0) 推荐(0) 编辑
摘要: 1 /*求n个数的的最小公倍数,这里运用了辗转相除法*/ 2 3 #include <stdio.h> 4 5 int gcd(int a,int b) //最大公约数算法 6 7 { 8 9 if(a%b==0)10 11 return b;12 13 else return14 15 gcd(b,a%b);16 17 }18 19 int lcm(int a,int b) //最小公倍数(两数相乘后除以最大公约数)20 21 {22 23 return a/gcd(a,b)*b; //注意先... 阅读全文
posted @ 2011-11-20 11:33 弄月吟风 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 3 using namespace std; 4 5 6 7 #define SWAP(i,j) {int t=(i);(i)=(j);(j)=t;} 8 9 10 11 //插入排序 12 13 void InsertSort(int*a,int len) 14 15 { 16 17 for (int i=1;i<len;i++) 18 19 { 20 21 int j=i,x=a[i]; 22 23 while (j && a[j-1]>x)a[... 阅读全文
posted @ 2011-11-20 11:18 弄月吟风 阅读(213) 评论(0) 推荐(0) 编辑