//Accepted    420K    16MS
 //考虑 0和n!    does not divide
 //      1和0!  divides
 #include <cstdio>
 #include <cstring>
 #include <iostream>
 using namespace std;
 <<)+;
 int pri[imax_n];
 int cnt;
 void prime()
 {
     ;i<imax_n;i++)
     {
         if ((long long )i*i<(long long )imax_n)
         for (int j=i*i;j<imax_n;j+=i)
         {
             pri[j]=;
         }
     }
     cnt=;
     ;i<imax_n;i++)
     )
     pri[cnt++]=i;
 }
 int getNumber(int n,int k)
 {
     ;
     ) ;
     )
     {
         ans+=n/k;
         n/=k;
     }
     return ans;
 }
 int split(int n,int m)
 {
     int t;
     //printf("n=%d\n",n);
     ) ;
     )
     {
         ) ;
         ;
     }
     ;i<cnt && (__int64 )pri[i]*pri[i]<=(__int64 )n;i++)
     {
         )
         {
             //printf("pri=%d\n",pri[i]);
             t=;
             )
             {
                 t++;
                 n/=pri[i];
             }
             int temp=getNumber(m,pri[i]);
             //printf("temp=%d t=%d\n",temp,t);
             ;
         }
     }
     )
     {
         int temp=getNumber(m,n);
         ) ;
     }
     ;
 }
 int main()
 {
     prime();
     int n,m;
     while (scanf("%d%d",&n,&m)!=EOF)
     {
         int ans=split(m,n);
         )
         {
             printf("%d divides %d!\n",m,n);
         }
         else
         {
             printf("%d does not divide %d!\n",m,n);
         }
     }
     ;
 }

poj2649 数论的更多相关文章

  1. Codeforces Round #382 Div. 2【数论】

    C. Tennis Championship(递推,斐波那契) 题意:n个人比赛,淘汰制,要求进行比赛双方的胜场数之差小于等于1.问冠军最多能打多少场比赛.题解:因为n太大,感觉是个构造.写写小数据, ...

  2. NOIP2014 uoj20解方程 数论(同余)

    又是数论题 Q&A Q:你TM做数论上瘾了吗 A:没办法我数论太差了,得多练(shui)啊 题意 题目描述 已知多项式方程: a0+a1x+a2x^2+..+anx^n=0 求这个方程在[1, ...

  3. 数论学习笔记之解线性方程 a*x + b*y = gcd(a,b)

    ~>>_<<~ 咳咳!!!今天写此笔记,以防他日老年痴呆后不会解方程了!!! Begin ! ~1~, 首先呢,就看到了一个 gcd(a,b),这是什么鬼玩意呢?什么鬼玩意并不 ...

  4. hdu 1299 Diophantus of Alexandria (数论)

    Diophantus of Alexandria Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java ...

  5. 【BZOJ-4522】密钥破解 数论 + 模拟 ( Pollard_Rho分解 + Exgcd求逆元 + 快速幂 + 快速乘)

    4522: [Cqoi2016]密钥破解 Time Limit: 10 Sec  Memory Limit: 512 MBSubmit: 290  Solved: 148[Submit][Status ...

  6. bzoj2219: 数论之神

    #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...

  7. hdu5072 Coprime (2014鞍山区域赛C题)(数论)

    http://acm.hdu.edu.cn/showproblem.php?pid=5072 题意:给出N个数,求有多少个三元组,满足三个数全部两两互质或全部两两不互质. 题解: http://dty ...

  8. ACM: POJ 1061 青蛙的约会 -数论专题-扩展欧几里德

    POJ 1061 青蛙的约会 Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%lld & %llu  Descr ...

  9. 数论初步(费马小定理) - Happy 2004

    Description Consider a positive integer X,and let S be the sum of all positive integer divisors of 2 ...

随机推荐

  1. 【bzoj1023】仙人掌图

    [bzoj1023]仙人掌图 题意 给一棵仙人掌,求直径. \(n\leq 100000\) 分析 分析1:[Tarjan]+[环处理+单调队列优化线性dp]+[树形dp] 分开两种情况处理: ①环: ...

  2. [saiku] 系统登录成功后查询Cubes

    一.系统启动时初始化ds和conn 1.查询出目前系统拥有的Datasources和Connections放入内存中 2.比对saiku-datasources中的ds是否有新增的,如果有,创建新的d ...

  3. 笔记13:File 类的一些操作

    一.对文件的创建(create) private void button1_Click(object sender, EventArgs e) { File.Create(@"F:\\QQP ...

  4. python中字符与ascii码转换

    ASCII码转字符用chr()函数:  字符转ASCII码用ord()函数:  

  5. 例子:使用C++中的this

    在C++中很多的东西都传值的,. C++中的对象之间的copy是传值的 , 他不想java那样,对象之间传递的引用 , 或者说是java对指针进行了封装 , 禁止了一些不安全的操作 对于C++而言 , ...

  6. MATLAB 损失函数画图

    损失函数画图 Hinge loss function: \[H(z) = max(0,1-z)\] $\psi$-learning loss function: \[{\phi _s}(z) = \l ...

  7. 5月21日 CSS样式表加阴影

    HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 ...

  8. Java多线程-新特性-线程池

    Sun在Java5中,对Java线程的类库做了大量的扩展,其中线程池就是Java5的新特征之一,除了线程池之外,还有很多多线程相关的内容,为多线程的编程带来了极大便利.为了编写高效稳定可靠的多线程程序 ...

  9. 对于transform的新认识

    transform-origin是作用于该元素自己的,transform-origin(0px,0px),是以该元素自己本身的左上角(0px,0px)为圆心进行动作的.

  10. POJ 3249 拓扑排序+DP

    貌似是道水题.TLE了几次.把所有的输入输出改成scanf 和 printf ,有吧队列改成了数组模拟.然后就AC 了.2333333.... Description: MR.DOG 在找工作的过程中 ...