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

22296번 - cubic 다국어언어 제한함수 구현

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 512 MB9212811.268%

문제

Write a function P7:

  • input parameter: integers a, b, c, d satisfying 1ドル\le\max(|$a$|,|$b$|,|$c$|,|$d$|)\le10^9$
  • return value: a list of all rational roots of the equation a$x^3+$b$x^2+$c$x+$d$=0,ドル in any order (Each root should be included only once.)
    • Suppose that $[t_0,t_1,\cdots,t_{n-1}]$ is the exact answer and $[u_0,u_1,\cdots,u_{m-1}]$ is your output.
    • Let $r(k)=\{i\in\mathbb Z:0\le i<k\}=\{0,1,\cdots,k-1\}$ for every non-negative integer $k$.
    • Your answer will be graded correct iff there exists a bijective function $\sigma\colon r(n)\to r(m)$ such that \[\frac{|u_{\sigma(i)}-t_i|}{\max(1,|t_i|)}\le10^{-6}\qquad\text{for all }i\in r(n)\]
  • Hint: The rational root theorem states the following:
    • Consider a polynomial function $f(x)=a_nx^n+a_{n-1}x^{n-1}+\cdots+a_0$ with integer coefficients where $a_n$ and $a_0$ are nonzero.
    • If $\displaystyle f\left(\frac{p}{q}\right)=0,ドル where $|p|$ and $|q|$ are relatively prime positive integers, then $\displaystyle\frac{a_0}{p}$ and $\displaystyle\frac{a_n}{q}$ are integers.

입력

출력

제한

힌트

첨부

출처

School > 한국과학영재학교 > 2021 Spring CS1 Final Mock Exam 7번

  • 문제를 만든 사람: parkky
  • 데이터를 추가한 사람: jh05013

제출할 수 있는 언어

PyPy3

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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