fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin>>n;
  7. int k=0;
  8. int f=1;
  9. for(int i=1;i<=n;i++)
  10. f=f*i;
  11. for(int i=1;i<=n;i++)
  12. {
  13. int c=1,r=1;
  14. for(int j=1;j<=i;j++)
  15. r=r*j;
  16. for(int j=1;j<=(n-i);j++)
  17. c=c*j;
  18.  
  19. k=k+(f/(c*r));
  20. }
  21. k=k-(n-1);
  22. cout<<k;
  23. // your code goes here
  24. return 0;
  25. }
Success #stdin #stdout 0s 5676KB
stdin
Standard input is empty
stdout
1