第四个点WA了,查不出来问题,有大佬帮忙吗
查看原帖
第四个点WA了,查不出来问题,有大佬帮忙吗
57755
Happy_Orca楼主2022/6/27 15:11
#include<bits/stdc++.h>
using namespace std;
int a,b,c,ans;
inline int read(){
	int ret=0,f=1;char ch=getchar();
	while(!isdigit(ch)) f=(ch=='-'?-f:f),ch=getchar();
	while(isdigit(ch)) ret=ret*10+ch-'0',ch=getchar();
	return ret*f;
}
int check(int x,int y){
	if(x%y==0) return y;
	return check(y,x%y);
}
int main(){
	a=read();b=read();c=b/a;
	for(int i=1;i<=c;i++){
		if(c%i==0&&check(i,c/i)==1) ans++;
	}
	printf("%d",ans);
	return 0;
}
2022/6/27 15:11
加载中...