求助
查看原帖
求助
835944
gyttnnd楼主2022/11/13 11:37
#include<bits/stdc++.h>
using namespace std;
int main()
{
	double m,n,p;
	cin>>m>>n>>p;
	for(int a=1;a<=9;a++)
	{
		for(int b=1;b<=9&&b!=a;b++)
		{
			for(int c=1;c<=9&&c!=a&&c!=b;c++)
			{
				for(int d=1;d<=9&&d!=a&&d!=b&&d!=c;d++)
				{
					for(int e=1;e<=9&&e!=a&&e!=b&&e!=c&&e!=d;e++)
					{
						for(int f=1;f<=9&&f!=a&&f!=b&&f!=c&&f!=d&&f!=e;f++)
						{
							for(int g=1;g<=9&&g!=a&&g!=b&&g!=c&&g!=d&&g!=e&&g!=f;g++)
							{
								for(int h=1;h<=9&&h!=a&&h!=b&&h!=c&&h!=d&&h!=e&&h!=f&&h!=g;h++)
								{
									for(int i=1;i<=9&&i!=a&&i!=b&&i!=c&&i!=d&&i!=e&&i!=f&&i!=g&&i!=h;i++)
									{
										double x=100.0*a+10.0*b+c;
										double y=100.0*d+10.0*e+f;
										double z=100.0*g+10.0*h+i;
										if(x/y==m/n&&x/z==m/p&&y/z==n/p)
										cout<<x<<" "<<y<<" "<<z<<endl;
									}
								}
							}
						}
					}
				}
			} 
		}
	}
	return 0;
}
2022/11/13 11:37
加载中...