Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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.
- Input: Numbers N and K.
- Output: The number of found tuples, and in each row after N+1 numbers A1, A2, ..., AN and B.
- 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