最后一个TLE,求大佬调一下代码
查看原帖
最后一个TLE,求大佬调一下代码
406170
Jason_yinkai楼主2021/8/14 18:15
#include<iostream>
#include<algorithm>
using namespace std;
int tran[3];
void out(double x,double y){
	for(double i = 1;i <= x;i++){
		for(double j = 1;j <= y;j++){
			if(i / j == x / y){
				cout<<i<<"/"<<j;
				return;
			}
		}
	}
}
int main(){
	cin>>tran[0]>>tran[1]>>tran[2];
	sort(tran,tran + 3);
	int a = tran[0],b = tran[2];
	out(a,b);
} 
2021/8/14 18:15
加载中...