首页 > 代码库 > cf 495b Modular Equations

cf 495b Modular Equations

技术分享
#include<cstdio>#include<cmath>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int main(){  int a,b,x;  while(scanf("%d%d",&a,&b)!=EOF)  {    if(a<b)    {      printf("0\n");    }    else if(a==b)    {      printf("infinity\n");    }    else    {      int i,ans=0;      int cha=a-b;      for(i=1;i*i<cha;i++)      {        if(cha%i==0)        {          if(i>b) ans++;          if(cha/i>b) ans++;        }      }      if(i*i==cha&&i>b) ans++;      printf("%d\n",ans);    }  }  return 0;}
View Code

 

cf 495b Modular Equations