为什么输入3和60会有六个输出,好像还都是对的
查看原帖
为什么输入3和60会有六个输出,好像还都是对的
449249
琴箫剑气楼主2020/12/26 15:02
#include<iostream>
using namespace std;
int main()
{
	int x,y,num=0;
	cin>>x>>y;
	int p,q;
	for(p=1;p<=y;p++)
	{
		for(q=1;q<=y;q++)
		{
			if(p%x==0&&q%x==0&&(p*q/x==y))
			{
				num++;
				cout<<"q="<<q<<" "<<"p="<<p<<endl;
			}
		}
	}
	cout<<num;
 } 
2020/12/26 15:02
加载中...