亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

蟲蟲首頁| 資源下載| 資源專輯| 精品軟件
登錄| 注冊

計(jì)算機(jī)程序

  • Euler函數(shù): m = p1^r1 * p2^r2 * …… * pn^rn ai >= 1 , 1 <= i <= n Euler函數(shù): 定義:phi(m) 表示小于等

    Euler函數(shù): m = p1^r1 * p2^r2 * …… * pn^rn ai >= 1 , 1 <= i <= n Euler函數(shù): 定義:phi(m) 表示小于等于m并且與m互質(zhì)的正整數(shù)的個數(shù)。 phi(m) = p1^(r1-1)*(p1-1) * p2^(r2-1)*(p2-1) * …… * pn^(rn-1)*(pn-1) = m*(1 - 1/p1)*(1 - 1/p2)*……*(1 - 1/pn) = p1^(r1-1)*p2^(r2-1)* …… * pn^(rn-1)*phi(p1*p2*……*pn) 定理:若(a , m) = 1 則有 a^phi(m) = 1 (mod m) 即a^phi(m) - 1 整出m 在實際代碼中可以用類似素數(shù)篩法求出 for (i = 1 i < MAXN i++) phi[i] = i for (i = 2 i < MAXN i++) if (phi[i] == i) { for (j = i j < MAXN j += i) { phi[j] /= i phi[j] *= i - 1 } } 容斥原理:定義phi(p) 為比p小的與p互素的數(shù)的個數(shù) 設(shè)n的素因子有p1, p2, p3, … pk 包含p1, p2…的個數(shù)為n/p1, n/p2… 包含p1*p2, p2*p3…的個數(shù)為n/(p1*p2)… phi(n) = n - sigm_[i = 1](n/pi) + sigm_[i!=j](n/(pi*pj)) - …… +- n/(p1*p2……pk) = n*(1 - 1/p1)*(1 - 1/p2)*……*(1 - 1/pk)

    標(biāo)簽: Euler lt phi 函數(shù)

    上傳時間: 2014-01-10

    上傳用戶:wkchong

  • //Euler 函數(shù)前n項和 /* phi(n) 為n的Euler原函數(shù) if( (n/p) % i == 0 ) phi(n)=phi(n/p)*i else phi(n)=phi(n/p

    //Euler 函數(shù)前n項和 /* phi(n) 為n的Euler原函數(shù) if( (n/p) % i == 0 ) phi(n)=phi(n/p)*i else phi(n)=phi(n/p)*(i-1) 對于約數(shù):divnum 如果i|pr[j] 那么 divnum[i*pr[j]]=divsum[i]/(e[i]+1)*(e[i]+2) //最小素因子次數(shù)加1 否則 divnum[i*pr[j]]=divnum[i]*divnum[pr[j]] //滿足積性函數(shù)條件 對于素因子的冪次 e[i] 如果i|pr[j] e[i*pr[j]]=e[i]+1 //最小素因子次數(shù)加1 否則 e[i*pr[j]]=1 //pr[j]為1次 對于本題: 1. 篩素數(shù)的時候首先會判斷i是否是素數(shù)。 根據(jù)定義,當(dāng) x 是素數(shù)時 phi[x] = x-1 因此這里我們可以直接寫上 phi[i] = i-1 2. 接著我們會看prime[j]是否是i的約數(shù) 如果是,那么根據(jù)上述推導(dǎo),我們有:phi[ i * prime[j] ] = phi[i] * prime[j] 否則 phi[ i * prime[j] ] = phi[i] * (prime[j]-1) (其實這里prime[j]-1就是phi[prime[j]],利用了歐拉函數(shù)的積性) 經(jīng)過以上改良,在篩完素數(shù)后,我們就計算出了phi[]的所有值。 我們求出phi[]的前綴和 */

    標(biāo)簽: phi Euler else 函數(shù)

    上傳時間: 2016-12-31

    上傳用戶:gyq

  • Visual 開發(fā) 希望對你們有幫助 public static int Rom(int n, int m)//雙寄或雙偶 { int count = 0 //第一排Y坐標(biāo)上要幾個

    Visual 開發(fā) 希望對你們有幫助 public static int Rom(int n, int m)//雙寄或雙偶 { int count = 0 //第一排Y坐標(biāo)上要幾個 if (n < m) { for (int i = 1 i <= n i = i + 2) { count++ } } else { for (int j = 1 j <= m j = j + 2) { count++ } } return count }

    標(biāo)簽: int Visual public static

    上傳時間: 2013-12-13

    上傳用戶:懶龍1988

  • 遙控解碼通過電腦串口顯示 /* 晶振:11.0569MHz */ #include <REGX52.h> #define uchar unsigned char uchar d

    遙控解碼通過電腦串口顯示 /* 晶振:11.0569MHz */ #include <REGX52.h> #define uchar unsigned char uchar data IRcode[4] //定義一個4字節(jié)的數(shù)組用來存儲代碼 uchar CodeTemp //編碼字節(jié)緩存變量 uchar i,j,k //延時用的循環(huán)變量 sbit IRsignal=P3^2 //HS0038接收頭OUT端直接連P3.2(INT0) /**************************延時0.9ms子程序**********************/ void Delay0_9ms(void) {uchar j,k for(j=18 j>0 j--) for(k=20 k>0 k--) } /***************************延時1ms子程序**********************/ void Delay1ms(void) {uchar i,j for(i=2 i>0 i--) for(j=230 j>0 j--) }

    標(biāo)簽: uchar unsigned 11.0569 include

    上傳時間: 2013-12-12

    上傳用戶:Breathe0125

  • Instead of finding the longest common subsequence, let us try to determine the length of the LCS.

    Instead of finding the longest common subsequence, let us try to determine the length of the LCS. 􀂄 Then tracking back to find the LCS. 􀂄 Consider a1a2…am and b1b2…bn. 􀂄 Case 1: am=bn. The LCS must contain am, we have to find the LCS of a1a2…am-1 and b1b2…bn-1. 􀂄 Case 2: am≠bn. Wehave to find the LCS of a1a2…am-1 and b1b2…bn, and a1a2…am and b b b b1b2…bn-1 Let A = a1 a2 … am and B = b1 b2 … bn 􀂄 Let Li j denote the length of the longest i,g g common subsequence of a1 a2 … ai and b1 b2 … bj. 􀂄 Li,j = Li-1,j-1 + 1 if ai=bj max{ L L } a≠b i-1,j, i,j-1 if ai≠j L0,0 = L0,j = Li,0 = 0 for 1≤i≤m, 1≤j≤n.

    標(biāo)簽: the subsequence determine Instead

    上傳時間: 2013-12-17

    上傳用戶:evil

  • //初始化 initscr() //獲得屏幕尺寸 getmaxyx(stdscr, h, w) //畫背景 for(i=0 i<h i++)

    //初始化 initscr() //獲得屏幕尺寸 getmaxyx(stdscr, h, w) //畫背景 for(i=0 i<h i++) for(j=0 j<w j++){ mvaddch(i, j, ACS_CKBOARD) } refresh() //建立窗口 pad = newpad(80, 128) for(i=0 i<80 i++){ char line[128] sprintf(line, "This line in pad is numbered d\n", i) mvwprintw(pad, i, 0, line) } //刷新屏幕 refresh() prefresh(pad, 0, 1, 5, 10, 20, 45) for(i=0 i<50 i++){ prefresh(pad, i+1, 1, 5, 10, 20, 45) usleep(30000) } //等待按鍵 getch()

    標(biāo)簽: getmaxyx initscr stdscr for

    上傳時間: 2014-08-30

    上傳用戶:龍飛艇

  • AVR單片機轉(zhuǎn)速表

    /****************************************************************                  外部晶振8M                  PA0~3:四位數(shù)碼管的位選                  PB0~7:數(shù)碼管的8位段選                  外部中斷0用于計數(shù)                  定時器0溢出中斷的定時為1ms                  說明 :檢測到水流較小時,繼電器延時1秒關(guān)閉  ******************************************************************/                #include<iom16v.h>   #include<macros.h>   #define uchar unsigned char   #define uint unsigned int       char led_7[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};  //數(shù)碼管段選        char position[4]={0xfe,0xfd,0xfb,0xf7};//數(shù)碼管位選        uint sumnum=0;  //用于記錄1000ms內(nèi)進入中斷的次數(shù)        uint time=0;   //記錄進入比較定時器0的次數(shù)        uint num=0;     //記錄1ms內(nèi)進入中斷的次數(shù)        uint count=0;   //進入外部中斷0的次數(shù)        uchar flag;        uint sumnum1;   //記錄100ms內(nèi)的數(shù)目       /***************************函數(shù)聲明***************************/        void delay();        void display(uint m );        void init();        void init_0();        void init_2();    void _delay_us(uint l)   {        unsigned int i;        for(i=0;i<l;i++)        {        asm("nop");        }   }           /**************************主函數(shù)***********************************/       void main()   {        init();        init_0();        init_2();        while(sumnum<5)        {           PORTD=0XBF;           segdisplay(sumnum1);        }       while(1)       {           segdisplay(sumnum1);       }           }        /*************************掃描數(shù)碼管時的延時函數(shù)*********************/        void delay()    {         uchar i,j;         for(i=6;i>0;i--)         for(j=225;j>0;j--);    }        /************************數(shù)碼管顯示函數(shù)*****************************/       void segdisplay( int temp)        {         int seg[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};         int temp1,temp2,temp3,temp4;         temp1=temp/1000;         temp2=(temp/100)%10;         temp3=(temp/10)%10;         temp4=temp%10;         DDRB=0xff;         DDRA|=0x0f;           PORTA=~BIT(3);           PORTB=seg[temp1];           _delay_us(100);           PORTA=~BIT(2);           PORTB=seg[temp2];           _delay_us(100);           PORTA=~BIT(1);           PORTB=seg[temp3];           _delay_us(100);           PORTA=~BIT(0);           PORTB=seg[temp4];           _delay_us(100);       }        /***********************管腳初始化函數(shù)*********************/        void init()    {                      DDRD|=0X40;   //PD4 設(shè)置為輸出             PORTD=0XBF;                DDRA=0XFF;             DDRB=0XFF;             PORTA=0XFF;             PORTB=0XFF;    }        /***********************外部中斷0初始化*********************/        void init_0()    {         MCUCR=0X02;   //INT0為下降沿觸發(fā)         GICR=0X40;   //使能INT0中斷         SREG=0X80;  //使能總中斷    }        /**********************定時器2初始化***********************/        void init_2()    {         TCCR0=0x03;   // 內(nèi)部時鐘,64 分頻(8M/64=125KHz)          TCNT0=0x83;   //裝初值           TIMSK=0x01;   // 允許 T/C0溢出中斷中斷      }          /***********************外部中斷0子函數(shù)********************/        #pragma interrupt_handler int0_isr:2        void int0_isr(void)        {             count++;        }        /*********************定時計數(shù)器0溢出中斷子函數(shù)*****************/       #pragma interrupt_handler int0_over:10        void int0_over(void)       {           TCNT0=0x83;   //重裝初值            if((time%100) == 0)               sumnum1 = num;           if(time == 1000)           {               sumnum=num;               if(sumnum<10)               {                                      if((flag==1)&&(sumnum<10))                   {                       PORTD=0XFF;                       flag=0;                   }                                      flag++;               }               else                       PORTD=0XBF;               num=0;               time=0;           }           num+=count;           count=0;           ++time;        } 

    標(biāo)簽: C語言

    上傳時間: 2016-03-09

    上傳用戶:彥 yan

  • 離散實驗 一個包的傳遞 用warshall

     實驗源代碼 //Warshall.cpp #include<stdio.h> void warshall(int k,int n) { int i , j, t; int temp[20][20]; for(int a=0;a<k;a++) { printf("請輸入矩陣第%d 行元素:",a); for(int b=0;b<n;b++) { scanf ("%d",&temp[a][b]); } } for(i=0;i<k;i++){ for( j=0;j<k;j++){ if(temp[ j][i]==1) { for(t=0;t<n;t++) { temp[ j][t]=temp[i][t]||temp[ j][t]; } } } } printf("可傳遞閉包關(guān)系矩陣是:\n"); for(i=0;i<k;i++) { for( j=0;j<n;j++) { printf("%d", temp[i][ j]); } printf("\n"); } } void main() { printf("利用 Warshall 算法求二元關(guān)系的可傳遞閉包\n"); void warshall(int,int); int k , n; printf("請輸入矩陣的行數(shù) i: "); scanf("%d",&k); 四川大學(xué)實驗報告 printf("請輸入矩陣的列數(shù) j: "); scanf("%d",&n); warshall(k,n); } 

    標(biāo)簽: warshall 離散 實驗

    上傳時間: 2016-06-27

    上傳用戶:梁雪文以

  • 1602數(shù)字時鐘

    # include < reg52.h > # include < 24C02.h> # define uint unsigned int # define uchar unsigned char   sbit rs = P3^5;  //定義lcd1602的rs端 sbit lcden = P3^4;//定義lcd1602的lcden端口 sbit s1 = P3^0;//定義功能鍵s1 sbit s2 = P3^1;//定義功能鍵s2 sbit s3 = P3^2;//定義功能鍵s3   sbit beep = P2^3;//定義蜂鳴器   uchar count, s1num; char miao,fen,shi; uchar code table[] = "Designer:X_ZL ";//定義初始上電時液晶默認顯示狀態(tài)     void delay_ms( xms )   //定義延時函數(shù) { uint i,j; for( i = xms ; i > 0 ; i --) for( j = 110 ; j > 0 ; j --); }  

    標(biāo)簽: 1602 數(shù)字時鐘程序

    上傳時間: 2016-07-28

    上傳用戶:游戲好嗎

  • 計算聲學(xué)響度

    Computation of loudness (Zwicker model) according to ISO 532B / DIN 45631 norms.  This model is valid for steady sounds. Code based on BASIC program published in the following article: Program for calculating loudness according to DIN 45 631 (ISO 532B)", E.Zwicker and H.Fastl, J.A.S.J (E) 12, 1 (1991).

    標(biāo)簽: 計算 聲學(xué)

    上傳時間: 2016-11-14

    上傳用戶:zztony16

主站蜘蛛池模板: 保山市| 武山县| 宣武区| 松潘县| 建昌县| 南丰县| 葫芦岛市| 滨海县| 澳门| 星座| 博客| 芮城县| 铁岭市| 莫力| 吴江市| 苍溪县| 杂多县| 崇文区| 蕉岭县| 凤冈县| 苍南县| 鸡泽县| 获嘉县| 崇仁县| 水富县| 安徽省| 美姑县| 涡阳县| 衡山县| 洛川县| 台东县| 高邑县| 育儿| 承德县| 齐齐哈尔市| 响水县| 秦皇岛市| 和林格尔县| 金秀| 武胜县| 耿马|