解法1:三重循环
#include <iostream> #include <cstdio> using namespace std; int main(){ int a, b, c; for(a = 1; a <= 9; a++) for(b = 1; b <= 9; b++) for(c = 0; c <= 9; c++){ int x = a * 100 + b * 10 + c; int y = b * 100 + c * 10 + c; if(x + y == 532) printf("%d %d %d\n", a, b, c); } return 0; }