Advertisement
Dorijanko

Supertrokuti(800)

Aug 24th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. Ivica became interested in N-dimensional "triangles". He also likes positive integers and hates large numbers. So he wants you to make him as many "Pythagora's (N+1)-tuples"; more precisely, make integers A1, A2, ..., AN and B such that B<=X, A1^2+A2^2+...+AN^2=B^2 and A1<=A2<=...<=AN.
  2. Input: Numbers N and K.
  3. Output: The number of found tuples, and in each row after N+1 numbers A1, A2, ..., AN and B.
  4. Scoring: Let's say your solution finds K tuples and the author's solution finds L tuples. In that case, if K<=L, you get (see formula from statement) points. If K>L, you get 30 points. If any of the tuples is invalid, you get 0 points.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement