学习历程
闪光的可达鸭
这个作者很懒,什么都没留下…
展开
-
学习历程-GCD
#include<stdio.h>int fun(int a,int b){ if(b==0) return a; else return fun(b,a%b);}int main(){ int a,b,t; while(1) { scanf("%d%d",&a,&b); while(b!=0) { t=b; b=a%b;...原创 2017-08-06 15:40:54 · 160 阅读 · 0 评论 -
学习历程-LCM
#include<stdio.h>int fun(int a,int b){ if(b==0) return a; else return fun(b,a%b);}int main(){ int a,b,t,a1,b1; while(1) { scanf("%d%d",&a,&b); a1=a;b1=b; while(b1!=0) ...原创 2017-08-06 15:46:25 · 251 阅读 · 0 评论 -
学习历程-素数打表
#include<stdio.h>#include<string.h>int main(){ int a[10000],n,b[10000],t,i,u; while(~scanf("%d",&n)) { memset(a,0,sizeof(a)); t=0; for(i=2;i<=n;i++) { if(a[i]...原创 2017-08-06 16:08:04 · 133 阅读 · 0 评论 -
学习历程-同余定理两大基本应用
1.大整数取模:应用公式可做到边运算边取余。公式入下:例如:1234%10首先整数都可化成如此形式,如1234化成((1*10+2)*10+3)*10+4进行求余(((1*10+2)*10+3)*10+4)%10此时用到两个公式(a+b)%c=(a%c+b%c)%c(a*b)%c=(a%c*b%c)%c计算过程比较麻烦,多次正反运用公式最终能得到1234%10=(((1%10*10+2)%10*1...原创 2017-09-05 18:12:04 · 1618 阅读 · 1 评论