a53

NumarPermutari

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