Advertisement
Ionut21

ciclu hemiltonian

Dec 12th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. bool ok;
  4. int n, rez[100002], R;
  5. int main()
  6. {
  7. cin >> n;
  8. n--;
  9. rez[0] = 1;
  10. rez[1] = 1;
  11. for(int i = 3; i <= n; ++i)
  12. {
  13. int t = 0;
  14. for(int j = 1; j <= rez[0] ; j++)
  15. {
  16. int cif = t + i * rez[j];
  17. rez[j] = cif % 10;
  18. t = cif / 10;
  19. }
  20. while(t)
  21. rez[++rez[0]] = t % 10, t /= 10;
  22. }
  23. for(int i = rez[0]; i; i--)
  24. cout << rez[i];
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement