fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void afisareSolutii(int c) {
  5. int x = 0, y = 0, z = 0;
  6. for (int z = c; z >= 0; --z) {
  7. if (x + y + z == c && x <= y && y <= z) {
  8. cout << x << " "<< y << " " << z << "\n";
  9. ++y;
  10. }
  11. --y;
  12. ++x;
  13. }
  14. }
  15. int main() {
  16. afisareSolutii(3);
  17. }
Success #stdin #stdout 0s 5520KB
stdin
Standard input is empty
stdout
0 0 3