fork download
  1. #include <iostream>
  2. #include<math.h>
  3.  
  4. using namespace std;
  5.  
  6. long int fac(int f)
  7. {
  8. if(f<2)
  9. return 1;
  10.  
  11. return(f*fac(f-1));
  12. }
  13.  
  14. long int combinatrics(int n,int r)
  15. {
  16. return(fac(n)/(fac(n-r)*fac(r)));
  17. }
  18.  
  19. int main() {
  20.  
  21. int t;
  22. while(t--)
  23. {
  24. int in,out=0;
  25. cin>>in;
  26.  
  27. for(int p=0;p<=in;p+=2)
  28. {
  29. int s=in-p;
  30. out=combinatrics(in,s)+(fac(p)/pow(2,p/2))+out;
  31. }
  32. cout<<out<<endl;
  33. }
  34. return 0;
  35. }
Success #stdin #stdout 0s 15240KB
stdin
2
3
2
stdout
Standard output is empty