help me!
  • 板块P2660 zzc 种田
  • 楼主HYR00000
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/8/7 22:32
  • 上次更新2024/8/8 08:44:42
查看原帖
help me!
1299520
HYR00000楼主2024/8/7 22:32
#include<bits/stdc++.h>
using namespace std;

int imax,imin,ans;
void f(int x,int y){
	if(x==y){
		ans=x*4;
	}
	else{
		if(x!=0 and y!=0){
			imax=max(x,y);
			imin=min(x,y);
			ans+=(imax/imin)*4;
			x=imin;
			y=imax%imin;
			f(x,y);
		}
		else{
			return;
		}
	}
}
int main(){
	long long x,y;
	cin>>x>>y;
	f(x,y);
	cout<<ans;
}

7红WA3黑TLE

各位大佬求救!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2024/8/7 22:32
加载中...