//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. [转]Android WebView播放视频(包括全屏播放),androidwebview

    Android WebView播放视频(包括全屏播放),androidwebview 最近项目开发中用到了WebView播放视频的功能,总结了开发中犯过的错误,这些错误在开发是及容易遇到的,所以我这里 ...

  2. Appium 切换上下文环境

    Appium 切换上下文环境,代码如下: private void switchToContext(String sContext) { LogManager.getLogger(this.getCl ...

  3. java 内部类3(匿名内部类)

    匿名内部类: 1.没有类名的类就叫匿名内部类 2.好处:简化书写. 3.使用前提:必须有继承或实现关系......不要想着你自己没有钱你没可是你爸有 4.一般用于于实参.(重点) class Oute ...

  4. 中医与DBA

    很多药方,只要吃不死,总有一款适合你.哈哈.我要做西医,先检查身体,再了解每种药的作用,做到对症下药.

  5. win8style布局

    <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" ...

  6. 资源 之 4.2 内置Resource实现(拾)

    4.2  内置Resource实现 4.2.1  ByteArrayResource ByteArrayResource代表byte[]数组资源,对于"getInputStream" ...

  7. (32)odoo中的编码问题

    对于全部是英文就不存在问题,但我们常用中文,这样会导致一个棘手的问题 约定: 系统Ubuntu trusty14.04 自带python2.7.6 python2.7.9 自己升级了 升级方法: -- ...

  8. struts2在pom.xml中的配置

    <dependencies> <dependency> <groupId>org.apache.struts</groupId> <artifac ...

  9. JavaScript学习——判断数据类型总结(转)

    一.JS中的数据类型 1.数值型(Number):包括整数.浮点数. 2.布尔型(Boolean) 3.字符串型(String) 4.对象(Object) 5.数组(Array) 6.空值(Null) ...

  10. toggleClass() 方法做类似于微信扣扣点击语音图标按钮变成切换到语音输入功能,点击键盘图标按钮切换到文字输入状态的效果

    就是这种效果的类似. <html><head><script type="text/javascript" src="/jquery/jqu ...