• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            ArcTan

            dfs
            隨筆 - 16, 文章 - 117, 評論 - 6, 引用 - 0
            數(shù)據(jù)加載中……

            2008 Hangzhou 網(wǎng)絡賽-D hdu2421 (數(shù)論)

            Problem Description:
            Xiaoming has just come up with a new way for encryption, by calculating the key from a publicly viewable number in the following way:
            Let the public key N = AB, where 1 <= A, B <= 1000000, and a0, a1, a2, …, ak-1 be the factors of N, then the private key M is calculated by summing the cube of number of factors of all ais. For example, if A is 2 and B is 3, then N = AB = 8, a0 = 1, a1 = 2, a2 = 4, a3 = 8, so the value of M is 1 + 8 + 27 + 64 = 100.
            However, contrary to what Xiaoming believes, this encryption scheme is extremely vulnerable. Can you write a program to prove it?

            Input
            There are multiple test cases in the input file. Each test case starts with two integers A, and B. (1 <= A, B <= 1000000). Input ends with End-of-File.
            Note: There are about 50000 test cases in the input file. Please optimize your algorithm to ensure that it can finish within the given time limit.
            Output
            For each test case, output the value of M (mod 10007) in the format as indicated in the sample output.
             

            summing the cube of number of factors of all ais.
            summing the cube of number of factors of all ais.
            summing the cube of number of factors of all ais.
            summing the cube of number of factors of all ais.
            summing the cube of number of factors of all ais.
            summing the cube of number of factors of all ais.
            summing the cube of number of factors of all ais.
            summing the cube of number of factors of all ais.
            summing the cube of number of factors of all ais.

            讀不懂題意就是傻逼啊!!!!!!!
            這個題目是要求每個因子的因子的個數(shù)然后再立方和啊啊啊啊
            8的因子有1 2 4 8,它們的因子數(shù)有1 2 3 4啊,立方和為1+8+27+64=100啊。
            轉化為算術基本定理:
            N=A^B
            求N的每個因子的因子數(shù):
                  任何一個大于1的數(shù)可以分解成 N=a1^p1*a2^p2*a3^p3*...*an^pn, N的約數(shù)總數(shù)為(p1+1)*(p2+1)*...*(pn+1),
                  (0,1,...,p1)(0,1,...,p2)...(0,1,...,pn)
                   不難發(fā)現(xiàn)(1^3+2^3+...+(p1+1)^3) (1^3+2^3+...+(p2+1)^3)...(1^3+2^3+...+(pn+1)^3)即為所求。


            #include<stdio.h>
            #include
            <string.h>
            #include
            <math.h>
            #define maxn 1000005
            int p[1015];
            int  b[1015];
            int tot;

            int eular()
            {
                memset(b,
            0,sizeof(b));
                
            int i=2;tot=0;
                
            while (i<1010)
                {
                    
            while (b[i])    i++;
                    p[tot
            ++]=i;
                    
            int j=i;
                    
            while (j<1010)
                    {
                        b[j]
            =1;
                        j
            +=i;
                    }
                }
                tot
            --;
                
            return 0;
            }

            int main()
            {
                
            long long A,B;
                
            int t=0;
                eular();
                
            while (scanf("%I64d%I64d",&A,&B)==2)
                {
                    printf(
            "Case %d: ",++t);
                    B
            %=10007;
                    
            long long ans=1;
                    
            long long t,tt;
                    
            int i=0;
                    
            while (i<tot && A>1)
                    {
                        t
            =0;
                        
            while (A%p[i]==0)
                            t
            ++,A/=p[i];
                        tt
            =(t*B+1)*(t*B+2)/2 % 10007;
                        tt
            =tt*tt % 10007;
                        ans
            =(ans*tt) % 10007;
                        i
            ++;
                    }
                    
            if (A>1)
                    {
                        tt
            =(B+1)*(B+2)/2 % 10007;
                        tt
            =tt*tt % 10007;
                        ans
            =(ans*tt)%10007;
                    }
                    printf(
            "%I64d\n",ans);
                }
                
            return 0;
            }




            posted on 2012-07-19 15:09 wangs 閱讀(218) 評論(0)  編輯 收藏 引用 所屬分類: ACM-數(shù)學

            久久99国产一区二区三区| 久久精品九九亚洲精品天堂| 最新久久免费视频| 久久九九亚洲精品| 亚洲AV无码成人网站久久精品大| 精品久久久噜噜噜久久久| 国产亚洲精久久久久久无码AV| 免费一级欧美大片久久网| 久久精品国产亚洲麻豆| 久久久久九国产精品| 久久久无码精品亚洲日韩软件| 久久精品国产99国产精品导航| 久久综合九色欧美综合狠狠| 天天爽天天狠久久久综合麻豆| 久久精品一区二区三区中文字幕 | 性欧美大战久久久久久久久| 99久久精品毛片免费播放| 国内精品久久久久伊人av| 青青草原综合久久大伊人导航| 久久av高潮av无码av喷吹| 一本一本久久aa综合精品| 午夜欧美精品久久久久久久| 很黄很污的网站久久mimi色| 成人综合伊人五月婷久久| 国产A三级久久精品| 亚洲一级Av无码毛片久久精品| 久久精品国产99国产精偷| 亚洲av日韩精品久久久久久a | 午夜精品久久久久久| 精品久久久无码中文字幕 | 波多野结衣AV无码久久一区| 色99久久久久高潮综合影院| 久久99国产精品成人欧美| 久久综合丝袜日本网| 国内精品久久久久影院免费| 97久久精品无码一区二区天美 | 99久久99久久精品国产| 精品久久久久久久久久中文字幕| 狠狠色婷婷综合天天久久丁香| 久久久久无码精品国产| 久久久久综合国产欧美一区二区|