# include <bits/stdc++.h>
using namespace std;
////第一种解法,用一层for循环
//int main()
//{
//   int n;
//   scanf("%d",&n);
//   long long s=0,t=1;
//   for(int i=1;i<=n;i++)
//     { t *=i;
//       s+=t;
//     }
//     printf("%lld",s);
//     return 0;
//    }

//第二种解法,用二层for循环
int main()
{
int n;
scanf("%d",&n);
long long s=0,t=1;
for(int i=1;i<=n;i++)
{
  t=1;
  for(int ls=1;ls<=i;++ls)
  {
    t*=ls;
  }
    s+=t;
  }
  printf("%lld",s);
  return 0;
}

相关文章:

  • 2021-07-13
  • 2021-07-15
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
猜你喜欢
  • 2021-09-08
  • 2021-12-17
  • 2021-11-17
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案