题目描述::
这道题的解法很多,
暴力
首先,你可以暴力快速幂,就是一个高精乘和一个高精除以低精
但是这样的时间复杂度实在高
代码实现难度也大
这里就不提供代码
分解质因数
以内的质数只有个
所以你可以分解质因数
然后看当前数的质因数是不是比的大
给一份代码::
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
inline void read(long long &x) {
x=0;
long long f=1;
char s=getchar();
while(s<48||s>57) {
if(s=='-')
f=-1;
s=getchar();
}
while(s>47&&s<58) {
x=x*10+s-48;
s=getchar();
}
x*=f;
}
inline void pr(long long x) {
if(x<0) {
putchar('-');
x=-x;
}
if(x>9)
pr(x/10);
putchar(x%10+48);
}//快读快输不解释
long long n,m,k,a,cnta,cntk,azzs[1255],azgs[1255],kzzs[1255],kzgs[1255],ans,zs[1255]={0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823