No.665 Bernoulli Bernoulli
問題文最終更新日: 2026-06-25 18:32:06
English (AI translation)
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 186
(順位表)
の他の問題:
Note
Given the writer's intended solution, this may be difficult in lightweight languages (LL).
Problem Statement
Compute $1^k + \cdots + n^k$ modulo $10^9 + 7$.
Input
$n$ $k$
$1 \le n \le 10^{16}$
$1 \le k \le 10^4$
Output
Output the result on one line. Print a newline at the end.
Sample
Sample 1
Input
10 1
Output
55
$1 + 2 + \cdots + 10 = 55$.
Sample 2
Input
10 3
Output
3025
$1^3 + 2^3 + \cdots + 10^3 = 3025$.
Sample 3
Input
10000 10000
Output
379988108
Sample 4
Input
1234567890123456 10000
Output
837110143
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
はむこ