#include <iostream> #include <cmath> using namespace std; int main() { int i, j, k, sum, n1, n2; while (cin >> sum) { for (i = 0; i <= 100; i++) { for (j = 0; j <= 100; j++) { for (k = 0; k <= 100; k++) { // 1. round(k/3.0) 四舍五入 // 2. 必须用3.0,否则用3会自动舍弃取整 if (( sum >= 5 * i + 3 * j + round(k/3.0) ) && (100 == i + j + k )) cout << "x=" <<i<<",y="<< j << ",z=" << k << endl; } } } } }