fork download
  1. #include <iostream>
  2. #include <math.h>
  3. #include <vector>
  4. using namespace std;
  5. int n;
  6.  
  7.  
  8. bool proverka (int i, int j,vector <int> &a) {
  9. if (a.size()!=0) {
  10. int k=a.size();
  11. for (int f=0;f<k;f++) {
  12. if ( i==a[f]/10||j==a[f]%10||i+j==a[f]/10+a[f]%10||i-j==a[f]/10-a[f]%10) {
  13. return 0;}
  14. }
  15. return 1;
  16. }
  17. }
  18.  
  19. void viviod_vectora (vector <int> a) {
  20. for (int f=0; f<a.size(); f++) {
  21. cout<<a[f]<<' ';}
  22. }
  23.  
  24. void udalenie (int &d, vector <int> &a) {
  25. for (int i=0;i<d;i++) {
  26. a.pop_back();}
  27. }
  28.  
  29. void recurs (int n, int j, vector <int> &a, int &d, int &vivod) {
  30. for (int i=1; i<=n; i++) {
  31. cout<<i*10+j<<endl;
  32. if (proverka(i,j,a)) {
  33.  
  34.  
  35. a.push_back(i*10+j);
  36. viviod_vectora(a); cout<<endl<<endl;
  37. if (j<n) {
  38.  
  39. recurs(n,j+1,a,d,vivod);
  40. }
  41.  
  42. else {
  43. a.pop_back();
  44. }
  45. }
  46. }
  47. if (a.size()==n) {
  48. vivod++;
  49. a.pop_back();
  50. }
  51. }
  52.  
  53. }
  54. }
  55.  
  56. int main() {
  57. cin>>n;
  58. int vivod(0);
  59. int d=1;
  60. vector <int> a;
  61. int j(1);
  62. recurs (n,j,a,d,vivod);
  63. cout<<vivod;
  64. return 0;
  65. }
  66.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
4
compilation info
prog.cpp:53:5: error: expected declaration before ‘}’ token
     }
     ^
stdout
Standard output is empty