fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool conflict(int i,int j){
  5. if((j-i)%4==0)
  6. return 1;
  7. if(j-i == 3)
  8. return 1;
  9. if(j-i == 5)
  10. return 1;
  11. return 0;
  12. }
  13.  
  14. int main() {
  15. int x,y,z,w;
  16. for(int q1=1;q1<=4;q1++){
  17. x = q1;
  18. for(int q2=5;q2<=8;q2++){
  19. if(!conflict(x,q2)){
  20. y = q2;
  21. for(int q3=9;q3<=12;q3++){
  22. if(!conflict(x,q3) && !conflict(y,q3)){
  23. z = q3;
  24. for(int q4=14;q4<=16;q4++){
  25. if(!conflict(x,q4) && !conflict(y,q4) && !conflict(z,q4))
  26. {
  27. w = q4;
  28. cout<<x<<" "<<y<<" "<<z<<" "<<w;
  29. return 0;
  30. }
  31. }
  32. }
  33. }
  34. }
  35. }
  36. }
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 5508KB
stdin
Standard input is empty
stdout
2 8 9 15