問題一覧 > 通常問題

No.1161 Many Powers

レベル : / AI推定難易度 : 900 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 105
作問者 : 蜜蜂 / テスター : Mitarushi
お気に入りにしたユーザー ProblemId : 4959 / 自分の提出
問題文最終更新日: 2020-08-11 23:55:08
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

Problem Statement

You are given integers $A,B,C$, each at least $1$.
Find the remainder when $1^B+2^B+3^B+\cdots+A^B$ is divided by $C$.

Input

$A\ \ \ B\ \ \ C$

All input values are integers.
$1 \leq A,B \leq 10^{12}$
$1 \leq C \leq 10^5$

Output

Output the answer on $1$ line.
Print a newline at the end.

Sample

Sample 1
Input
2 4 5
Output
2

Since $1^4+2^4=17$, output $2$, the remainder when divided by $5$.

Sample 2
Input
6 5 83
Output
0

Since $1^5+2^5+3^5+4^5+5^5+6^5=12201$, it is divisible by $83$. Therefore, output $0$.

Source

Nada High School 75th Class Junior High Graduation Commemorative Contest: Many Powers
writer: Mitsubachi
tester: Mitarushi
Ported in accordance with HackerRank's terms of service. Some parts have been modified.

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