题目描述:
 
 解题思路:
 
方法1:画图+计算器

方法2:代码
只需要判断两个数谁大谁小,用大的除以小的,得到的值即为当前能得到最大正方形的个数,再用大的减去小的*个数,之后再循环判断
这是一道很简单的填空题,两种方法都可以,只是方法1容易有计算失误,我更喜欢方法2
 代码:
 
#include<bits/stdc++.h>
using namespace std; 
int main(void){
	int a,b;
	int ans = 0;
	cin >> a >> b;
	while(!(a <= 0 || b <= 0)){
		int temp = 0;
		//逻辑很简单,如果a>b,就用a除b,得到的值就为边长=b时正方形的个数
		if(a>=b){
			temp = a / b;
			a -= b*temp;
			ans += temp;
		}else{//b>a,进行相同操作  
			temp = b / a;
			b -= a*temp;
			ans += temp;
		}
	}
	cout << ans;
} 
 
解题结果:

 










