思路
暴力三层循环就好了...
#include<iostream> using namespace std; int main(){ for(int a = 1; a <= 9; a ++){ for(int b = 1; b <= 9; b ++){ for(int c = 0; c <= 9; c ++){ if(a * 100 + b * 110 + c * 12 == 532) cout << a << " " << b << " " << c << endl; } } } }
暴力三层循环就好了...
#include<iostream> using namespace std; int main(){ for(int a = 1; a <= 9; a ++){ for(int b = 1; b <= 9; b ++){ for(int c = 0; c <= 9; c ++){ if(a * 100 + b * 110 + c * 12 == 532) cout << a << " " << b << " " << c << endl; } } } }