#include using namespace std; //本题有坑,使用长整也过不了洛谷的用例,因为它的用例是22, //需要高精度,也就是乘法高精度+加法高精度 typedef long long LL; int n; LL res; int main() { cin >> n; for (int i = 1; i <= n; i++) { // 1~n LL f = 1; // 基底 for (int j = 1; j <= i; j++) f *= j; // f =n! res += f; // 1!+2!+3!+...+n! } cout << res << endl; return 0; }