Logo
(追記) (追記ここまで)

24660번 - High Powers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB46342976.316%

문제

Given are integers $s,ドル $t,ドル and $u$.

Let $a,ドル $b,ドル and $c$ be distinct complex numbers that satisfy the following conditions:

  • $a+b+c=s,ドル
  • $ab + bc + ca=t,ドル
  • $abc=u$.

It is guaranteed that such $a,ドル $b,ドル and $c$ exist for the given $s,ドル $t,ドル and $u$.

Given positive integers $n$ and $m,ドル calculate the ratio

$$ \frac{a^n(b^m-c^m)+b^n(c^m-a^m)+c^n(a^m-b^m)}{(a-b)(b-c)(c-a)} $$

modulo 998ドル,244円,353円$.

입력

The first line of input contains two integers $n$ and $m$ (1ドル \le n, m \le 10^{18}$).

The second line contains three integers $s,ドル $t$ and $u$ (0ドル \le s, t, u < 998,244円,353円$).

It is guaranteed that the distinct complex numbers $a,ドル $b,ドル and $c$ from the statement exist for the given $s,ドル $t,ドル and $u$.

출력

It can be shown that the answer can be represented as a rational number $p/q$ where $p$ and $q$ are integers, $(p,q)=1,ドル $q>0$ and $q$ is not divisible by 998ドル,244円,353円$.

제한

예제 입력 1

2 3
314 159 265

예제 출력 1

159

예제 입력 2

1000000000000000000 800000000000000000
6 11 6

예제 출력 2

76083766

예제 입력 3

1000000000000000000 500000000000000000
505459328 165146837 982639180

예제 출력 3

228155372

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2022 > Day 1: Kyoto U Contest 2 H번

Contest > Open Cup > 2021/2022 Season > Stage 10: Grand Prix of Kyoto H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /