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

20704번 - Find a Square 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
6 초 512 MB1641185.594%

문제

Frank likes square numbers. That is numbers, which are the product of some integer with itself. Also Frank likes quadratic polynomials. He even has his favorite one: $p(x) = a \cdot x^2 + b \cdot x + c$.

This morning Frank evaluated his favorite quadratic polynomial for $n$ consecutive integer arguments starting from 0ドル$ and multiplied all the numbers he got.

If the resulting product is a square, his day is just perfect, but that might be not the case. So he asks you to find the largest square number which is a divisor of the resulting product.

입력

The only line of the input contains 4 integers $a, b, c, n$ (1ドル \le a,b,c,n \le 600,000円$).

출력

Find the largest square divisor of $\prod\limits_{i=0}^{n-1}{p(i)}$. As this number could be very large, output a single integer --- its remainder modulo 10ドル^9+7$.

제한

예제 입력 1

1 1 1 10

예제 출력 1

74529

예제 입력 2

1 2 1 10

예제 출력 2

189347824

힌트

In the first example, the product is equal to 1ドル\cdot 3\cdot 7\cdot 13\cdot 21\cdot 31\cdot 43\cdot 57\cdot 73\cdot 91 = 2893684641939 = 38826291 \cdot 273^2$.

출처

ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > Northern Eurasia Finals 2020 (Online) F번

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

출처

대학교 대회

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

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