問題一覧 > 通常問題

No.3002 Polynomial Division ~easy~

レベル : / AI推定難易度 : 600 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 93
作問者 : ジュ・ビオレ・グレイス / テスター : 👑 p-adic
お気に入りにしたユーザー ProblemId : 11814 / 自分の提出
問題文最終更新日: 2025-01-12 00:57:36
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 455 (順位表) の他の問題:

Problem Statement

For integers $A, B$ given as input, find the remainder when the polynomial $A x^B$ is divided by $x^2 + x + 1$.

Input

$A \ B$

$-10^4 \leq A \leq10^4,$
$0 \leq B \leq 10^4$

Output

When the remainder can be expressed as $ax + b$, print $a \ b$ separated by a single half-width space, followed by a newline at the end. It can be proved that the answer fits in a 64-bit integer.

Sample

Sample 1
Input
1 3
Output
0 1

We have $x^3 = (x-1)(x^2 + x + 1) + 1$.

Sample 2
Input
2 5
Output
-2 -2

We have $2x^5 = 2(x^3 - x^2 + 1)(x^2 + x + 1) - 2x - 2$.

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