cʵÏÖµÄÇóÁ½¸öÊýµÄ³Ë·¨ÄæÔª
¶¨Ò壺Éèa¶ÔbµÄ³Ë·¨ÄæÔªÊÇxÔò¿ÉÒÔ¼ÇΪa*x=1 mod b£¬¼´aºÍxµÄ»ý³ýÒÔbµÄÓàÊýÊÇ1£»
³Ë·¨ÄæÔª³£ÓÃËã·¨ÊÇÅ·¼¸ÀïµÂËã·¨£º
//Ëã·¨Çód¹ØÓÚÄ£fµÄ³Ë·¨ÄæÔªd-1 £¬¼´ d* d-1 mod f = 1
¡¡¡¡1 ¡£(X1£¬X2£¬X3) := (1£¬0£¬f)£» (Y1£¬Y2£¬Y3) := (0£¬1£¬d)
¡¡¡¡2¡£ if (Y3=0) then return d-1 = null //ÎÞÄæÔª
¡¡¡¡3¡£ if (Y3=1) then return d-1 = Y2 //Y2ΪÄæÔª
¡¡¡¡4¡£ Q := X3 div Y3 //Õû³ý
¡¡¡¡5¡£ (T1£¬T2£¬T3) := (X1 - Q*Y1£¬X2 - Q*Y2£¬X3 - Q*Y3)
¡¡¡¡6 ¡£(X1£¬X2£¬X3) := (Y1£¬Y2£¬Y3)
¡¡¡¡7¡£ (Y1£¬Y2£¬Y3) := (T1£¬T2£¬T3)
8¡£ goto 2
³£ÓÃÓÚ¼ÓÃÜËã·¨ÖУ¬Èç·ÂÉäËã·¨¡£
²ÉÓÃÀ©Õ¹Å·¼¸ÀïµÂËã·¨
Ê×ÏÈ,Å·¼¸ÀïµÂËã·¨ÓÖ³ÆշתÏà³ý·¨,ÓÃÓÚÇó×î´ó¹«Ô¼Êý,Ëã·¨ÈçÏÂ:
int Gcd(int a, int b)
{
if(b == 0)
return a;
return Gcd(b, a % b);
}
ÇóÒ»¸öÊý¶ÔÁíÒ»¸öÊýµÄ³Ë·¨ÄæÔªËã·¨ÈçÏ£º
Typedef unsigned short int uint16£»
uint16 mulinv(uint16 b£¬uint16 a) //ÇóÒ»¸öÕûÊýb¶ÔaµÄ³Ë·¨ÄæÔª
{
int x1,x2,x3;
int y1,y2,y3;
int t1,t2,t3;
x1=1;
x2=0;
x3=a;
y1=0;
y2=1;
y3=b;
int k;
for(t3=x3%y3;t3!=0;t3=x3%y3){
k=x3/y3;
t2=x2-k*y2;
t1=x1-k*y1;
x1=y1;
x2=y2;
x3=y3;
y1=t1;
y2=t2;
y3=t3;
}
if(y2<0)
y2+=a;
if(y3==1)
retu
Ïà¹ØÎĵµ£º
ѧϰlinuxϵÄc/c++±à³Ì
1£¬ÏÈÓÐlinux»·¾³
´îminGWºÍcygwin¶¼ÓеãÂé·³£¬×î×î¼òµ¥µÄ°ì·¨»¹ÊÇ×°¸öÕæÕýµÄlinux£¬ÓÃÐéÄâ»úÒ²ºÃ£¬ÔÚÍøÂçÉϵÄÁíһ̨»úÆ÷Ò²ºÃ¡£ÕâÑù²»½ö¿ì£¬¶øÇÒÄãÓÐÁËÕæÕýµÄ»·¾³¡£
2.»áC/C++ÓïÑÔ£¨¹À¼ÆÄã»áµÄ£©
3.ÈëÃŽ׶ÎÊìϤgccÃüÁîÐУ¬×î»ù±¾µÄ²ÎÊý£¬È磬-g,-W,-O,-o,-c ½¨Òé¿´man gcc(ºÜ´óÕÒÏ ......
ÕâÊÇÈëÃÅƪÖÐÌáµ½µÄÄÇÁ½Ì⣺
int * (* (*fp1) (int) ) [10];
int *( *( *arr[5])())();
½â´ðÈçÏÂ
1.int * (* (*fp1) (int) ) [10];
´ÓÍâÍùÄÚ½øÐзÖÎö
a.typedef P=(* (*fp1) (int) )£¬ÄÇôÔÉùÃ÷¸ÄдΪ int*P[10]£¬ÕâÊÇÒ»¸öÓÐ10¸öÔªËصÄÊý×飬ÿ¸öÔªËض¼ÊÇÒ»¸öÖ¸ÏòÕûÐÍÊýµÄÖ¸Õë
b.typedef Q=(*fp1)£¬ÄÇôP¸ÄдΪ *Q( ......
CµÄº¯ÊýÖ¸ÕëºÜÇ¿´ó£¬ÓúÃÁ˲ÅÊÇCÓïÑԵĸßÊÖ¡£ÏñGtkÖеĻص÷º¯ÊýµÄʹÓ㬶¼ÌåÏÖÁ˺¯ÊýÖ¸ÕëµÄÇ¿´óÍþÁ¦¡£
struct Point{
int x, y;
};
/*Shape*/
/*----------------------------------------------------------------*/
struct Shape {
struct Methods* methods;
};
struct Meth ......