Problem H: 阶乘和
#include<stdio.h> int main() { int i=0; int ret=1; int sum=0; int n; scanf("%d",&n); for(i=1;i<=n;i++) { ret=ret*i; sum+=ret; } printf("%d\n",sum); return 0; }
#include<stdio.h> int main() { int i=0; int ret=1; int sum=0; int n; scanf("%d",&n); for(i=1;i<=n;i++) { ret=ret*i; sum+=ret; } printf("%d\n",sum); return 0; }