为啥不输出
查看原帖
为啥不输出
1048589
HuangBarry楼主2024/5/1 10:34
#include<bits/stdc++.h>
using namespace std;
int main(){
	for(int i=111;i<=999;i++)
		for(int j=111;j<=999;j++)
			for(int k=111;k<=999;k++){
				if(j*1.0/i!=0.5||k*1.0/j!=1.5)
					continue;
				string s="";
				s+=to_string(i);
				s+=to_string(j);
				s+=to_string(k);
				sort(s.begin(),s.end());
				if(s=="123456789")
					cout<<i<<" "<<j<<" "<<k<<endl;
			}
	return 0;
}

2024/5/1 10:34
加载中...