問題一覧 > 通常問題

No.2137 Stairs of Permutation

レベル : / AI推定難易度 : 1750 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 43
作問者 : taiga0629kyopro / テスター : kaichou243
お気に入りにしたユーザー ProblemId : 8726 / 自分の提出
問題文最終更新日: 2022-10-25 02:45:26
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 369 (順位表) の他の問題:

Problem Statement

For a permutation $P$ of $(1,2,\dots,N)$, define $f(P)$ as follows.

    $f(P)=1 \le i \le N$ and $\max(P_1,P_2,\dots,P_i)=P_i$: the number of integers $i$ satisfying these conditions

There are $N!$ permutations $P$ of $(1,2,\dots,N)$. Find the sum of $f(P)^3$ over all of them, modulo $998244353$.

Input

$N$

  • $1 \le N \le 10^7$
  • All inputs are integers.
  • Output

    Output the answer.

    Sample

    Sample 1
    Input
    3
    Output
    53

    We have $f((1,2,3))^3+f((1,3,2))^3+f((2,1,3))^3+f((2,3,1))^3+f((3,1,2))^3+f((3,2,1))^3=3^3+2^3+2^3+2^3+1^3+1^3=53$.

    Sample 2
    Input
    100
    Output
    549865790

    提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。