求助,全RE
  • 板块P1592 互质
  • 楼主月野秋见
  • 当前回复6
  • 已保存回复6
  • 发布时间2021/7/9 10:12
  • 上次更新2023/11/4 18:21:11
查看原帖
求助,全RE
490997
月野秋见楼主2021/7/9 10:12
#include<bits/stdc++.h>
using namespace std;
bool judge(int x,int y){
	while(x!=y){
		x%=y;
		y%=x;
	}
	if(x!=1)return 1;
	else return 0;
}
int ans=0,c[100001],j;
int main(){
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		if(judge(i,n)==1){
			ans++;
			j++;
			c[j]=i;
		}
	cout<<c[k%ans]+n*(k/ans);
	return 0;
}




2021/7/9 10:12
加载中...