社区讨论

样例过了但是全RE

P10570 [JRKSJ R8] 网球参与者 2已保存回复 7

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
7 条
当前快照
1 份
快照标识符
@lxbvovaf
此快照首次捕获于
2024/06/12 21:40
2 年前
此快照最后确认于
2024/06/13 15:06
2 年前
查看原帖
CPP
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
	if(a<b) swap(a,b);
	if(a%b==0) return b;
	gcd(b,a%b);
}
int main(){
	int t;
	cin>>t;
	for(int i=1;i<=t;i++){
		int a,b,c,cnt,s,x;
		cin>>a>>b>>c;
		cnt=gcd(a,b);
		a/=cnt,b/=cnt;
		x=min(a,b);
		cnt=c-x;
		s=cnt/x;
		if(cnt%x==0) s++;
		else s+=2;
		cout<<(a+b)*s<<"\n";
	}
	return 0;
}
样例过了但是全RE,何哉??

回复

7 条回复,欢迎继续交流。

正在加载回复...