40分求助
  • 板块P8443 gcd.
  • 楼主wynne0323
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/8/17 14:30
  • 上次更新2024/8/17 14:35:14
查看原帖
40分求助
1036356
wynne0323楼主2024/8/17 14:30
#include<bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		long long x,y,z;
		cin>>x>>y>>z;
		x/=z;
		y/=z;
		if(z==1){
			cout<<1<<endl;
		}
		else{
			cout<<__gcd(x,y)<<endl;
		}
	}
	return 0;
}
2024/8/17 14:30
加载中...