TLE
查看原帖
TLE
1278268
Song_jiayu楼主2024/12/22 14:09
#include<bits/stdc++.h>
using namespace std;
//larger--->对边与斜边的较小值 
//divisor--->最大公约数 
//opposite--->对边 
//hypotenuse--->斜边 
int a,b,c,sine,divisor;
int opposite,hypotenuse;
int main(){
	cin>>a>>b>>c;
	opposite=min(a,min(b,c));
	hypotenuse=max(a,max(b,c));
	int larger=min(opposite,hypotenuse);
	for(int i=larger;i>=2;i++){
		if(opposite%i==0 and hypotenuse%i==0){
			divisor=i;
			break;
		}
	}
	if(divisor!=0){
		opposite/=divisor,hypotenuse/=divisor;
	}
	printf("%d/%d",opposite,hypotenuse);
	return 0;
} 

2024/12/22 14:09
加载中...