DC vs Marvel
All submissions for this problem are available.It is here - the biggest battles of all times - DC vs Marvel! The DC folk all stand on the left of the battlefield. The Marvel folk all stand on the right of the battlefield. This war though, will be bloodless. At the center of the battlefield sits Jedi Master Yoda! Yoda has decided, for the sake of the entire universe that both the guilds of superheroes do not fight with violence but rather with brains. He sets up in the middle of the battlefield the Goblet of Fire which burn with high blue flames! He allows a certain number of rounds. In each round, a member from both sides will be allowed to toss in a piece of paper into the Goblet of Fire containing their names. The Goblet of Fire then spits out a single paper containing a prime number. Yoda transfers this number to Gandalf the Grey who being a magician instantly finds out which side won the round. His trick is - he again breaks down this number into two numbers whose squares add up the number in the paper. The number on the left is allotted to DC and the number on the right is allotted to Marvel (same as their positions in the battlefield!). The side which gets the higher number is declared winner by Gandalf (oh that wise sly fellow!). But suddenly Gandalf disappears and the world is thrown into chaos! It is now up to you to determine the winner among the fighting guilds by doing the same that Gandalf did! But remember! You are biased! You cheat and always allot the larger number to DC!
Input:The first line of input contains a single integer N which denotes the number of rounds to be held. N lines follow, one for each round containing a single prime integer S.
Output:Break the integer S into two positive integers a and b whose squares add up to S. For each round, in a line output both numbers separated by space such that a > b.
Constraints:1 <= N <= 100 2 <= S <= 109
ExplanationThere are 3 test cases. For the first test case, 5 = 22 + 12 so the output is 2 1 For the second test case, 13 = 32 + 22 so the output is 3 2 For the third test case, 17 = 42 + 12 so the output is 4 1
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS|
Fetching successful submissions