返回题解分享
讨论 / 题解分享/ 帖子详情

奇怪的分式(结果填空) - 题解

#include <iostream>
#include <cmath>
using namespace std;

int main()
{
	int res=0;
	for(int x1=1;x1<=9;x1++)
		for(int x2=1;x2<=9;x2++)
			for(int y1=1;y1<=9;y1++)
				for(int y2=1;y2<=9;y2++)
				{
					if(x1==x2&&y1==y2) continue;
					double a=(x2*y2*1.0)/(x1*y1);
					double b=(x2*10+y2*1.0)/(x1*10+y1);
					if(a==b) res++;	
				}
	cout<<res;
	return 0;
}
0 回复 0 转发 0 喜欢 2 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!