正文
增加 4 行删除 4 行
112 行未改动全部展开113114115116117118119120121122123124125110 行未改动全部展开2362372382392402412422432445 行未改动25025125225325425525625725814 行未改动112 行未改动全部展开cin >> n;s[0] = 1;for(int i = 1; i <= n; i++){s[i] = i * s[i - 1] % MOD;}for(int i = 2; i <= n; i++){int k = (n - i + 1);ans = (ans + i * s[k] % MOD * (Pow(k + 1, i - 1) - Pow(k, i - 1))) % MOD;}ans += n + 1;cout << (ans * Pow(s[n], MOD - 2)) % MOD;return 0;}110 行未改动全部展开void dijkstra(){for(int i = 0; i < k; i++){dis[i] = 1e18;}priority_queue<node> q;dis[0] = 0, q.push({0, 0});while(!q.empty()){node t = q.top(); q.pop();if(dis[t.x] != t.w){5 行未改动dis[p] = dis[t.x] + a[i];q.push({p, dis[p]});}}}}signed main(){ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);14 行未改动112 行未改动全部展开113114115116117118119120121122123124125110 行未改动全部展开2362372382392402412422432445 行未改动25025125225325425525625725814 行未改动112 行未改动全部展开cin >> n;s[0] = 1;for(int i = 1; i <= n; i++){s[i] = i * s[i - 1] % MOD;}for(int i = 2; i <= n; i++){int k = (n - i + 1);ans = (ans + i * s[k] % MOD * (Pow(k + 1, i - 1) - Pow(k, i - 1))) % MOD;}ans += n + 1;cout << (ans * Pow(s[n], MOD - 2)) % MOD;return 0;}110 行未改动全部展开void dijkstra(){for(int i = 0; i < k; i++){dis[i] = 1e18;}priority_queue<node> q;dis[0] = 0, q.push({0, 0});while(!q.empty()){node t = q.top(); q.pop();if(dis[t.x] != t.w){5 行未改动dis[p] = dis[t.x] + a[i];q.push({p, dis[p]});}}}}signed main(){ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);14 行未改动