The Big TheoremProblem code: O4 |
You are given integers x and n. You need to find two positive integers a and b, such that a^n - b^n = x^n.
Input :
The first line contains the number of test cases T. Each of the next T lines contains 2 integers x and n.Output :
Output T lines, one for each test case, containing two integers a and b as needed. If there are multiple solutions, output the one with the smallest a. It is guaranteed that a solution will always exist.Constraints :
1 <= x <= 100000 3 <= n <= 10| Date: | 2010-04-01 |
| Time limit: | 1s |
| Source limit: | 50000 |
| Languages: | C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C# C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp SCALA HASK ERL CAML CLPS PRLG WSPC BF ICK JS |
Comments

Fetching successful submissions

what? how is this possible?
what? how is this possible?
i m sure all they re trying
i m sure all they re trying to say is: April fool!!!! :):)
lol never realized that
lol never realized that totally fooled!!! you got me guys! :P :P
no sample I/O?
no sample I/O?
No X problem this time around
No X problem this time around ?
@ Abhijit: No!!! i think they
@ Abhijit: No!!! i think they re working on it!!! i read somewhere that this month there are going to be 2 challenge problems!! Check the forums!!!
heyii can you please tell me
heyii can you please tell me form of output
whether
output:
3 4
or
output:
3
4
@Santosh: Either is ok!!
@Santosh: Either is ok!!
Either output will work fine.
Either output will work fine.
@Subhash The problem
@Subhash The problem statement is fine :)
Can you give a sample
Can you give a sample input/output
I think this is a trick
I think this is a trick question, we have to give a boolean answer stating wether such a thing is possible or not.
So it that just April
So it that just April fool?
It's in contradiction with Fermat last theorem..
Or it must have some trick!
@ admins very funny guys.
@ admins
very funny guys. This is the fermat's last theorom. it states that a^n+b^n=x^n if and only if n<=2
so for all numbers greater than 2, u will never be able to find the answer.
so similarly, x^n-a^n=b^n is not possible for n<=2...
April Fools to all huh?? :P
Provide a Example Input And
Provide a Example Input And Output plz..
any test cases, if possible?
any test cases, if possible?
Actually I have discovered a
Actually I have discovered a truly marvelous code to solve this question but the computational power of your system is too low to run it.
@Neelesh: LOL =))
@Neelesh: LOL =))
But there is nothing about a
But there is nothing about a and b constraints. The can be negative, I guess. In that case, solution is always exists. But failed to solve this problem, anyway :(.
@Max You need to find two
@Max
You need to find two positive integers a and b
read question carefully
in input: take 'x' first or
in input:
take 'x' first or 'n' first
in output:
print 'a' first or 'b' first
pls hlp?
@admin Please provide some
@admin Please provide some sample input output cases
wat is the range of test
wat is the range of test cases and values of 'a' & 'b'?
@Anurag they cant provide
@Anurag
they cant provide input/output sample cases
bcoz by doing dat, trick to this ques will get revealed
i think question is perfectly
i think question is perfectly right but don't know where is the mistake must be very small.
you are doing programming not math.
@santosh kumar but it is the
@santosh kumar
but it is the fermat's last theorem:-
a^n + b^n =c^n is not possible for n>2
the above can be re-written as:
c^n - b^n =a^n
which is the eqn given to us for n>=3
1 <= x <= 100000 3 <= n <=
1 <= x <= 100000 3 <= n <= 10
is this
1 <= x <= 100000 & 3 <= n <= 10
or 1 <= x <= 1000003 <= n <= 10 which is slightly contradictory :P
I know the solution to this
I know the solution to this problem!!!
Every test case file begins with '0' (The number of test cases!!).
Output nothing. :)
don't we need a limit on T
don't we need a limit on T
@admin: This is terribly
@admin: This is terribly unprofessional behaviour.
heyii if we think ^ as
heyii if we think ^ as bitwise operator then it is possible but didn't get accepted
anyone has any idea about this
sample i/p: 1 6 2 o/p: 10
sample i/p:
1
6 2
o/p:
10 8
but codechef always ignore my solution by saying "time limit exceeded"
@$um@n n >= 3, so 2 is
@$um@n
n >= 3, so 2 is invalid.
@$um@n 3 <= n <= 10
@$um@n
3 <= n <= 10
I am getting the
I am getting the answer
I/P
1
1000 3
O/P
6459 6451
is it right pls tell me
LOL it's so funny people are
LOL it's so funny people are actually trying to code this!!
@max lapan yh,u r right
@max lapan
yh,u r right man..i was considering n>=1
@codechef.... Plz tell us if
@codechef....
Plz tell us if its solution exists or not..I have been thinking on it for 3 hrs.I searched da whole google n they have even given us the proof of Ferment's Last theorem..I definitely think its wrong..Just tell us if it can be solved or not..Its just waste of time giving this problem.Plz reply sooooooon...
i'm almost done with the
i'm almost done with the solution,i just need to know
that
are 'a' and 'b' non zero integers?
am getting the
am getting the answer
I/P
1
1000 3
O/P
6459 6451
is it right pls tell me
can anyone tell me
@Anurag does not work last
@Anurag does not work last digit of 6459^3 is 9 and last digit of 6451^3 is 1 so last digit of 6459^3 - 6451^3 is 8... last digit of 1000^3 is 0 :P
@admin: This 'fools' version
@admin: This 'fools' version is 'symbolic' of the contests organized here.
@admin: This 'fools' version
@admin: This 'fools' version is 'symbolic' of the contests organized here.
@admin: This 'fools'
@admin: This 'fools' version is 'symbolic' of the contests organized here.
@everyone If there are
@everyone
If there are multiple solutions, output the one with the smallest a.
least value of a is when
a=x;
this gives b=0; which satisfies the eqn also.
so everytime o/p will be:-
x 0
where x is i/p.
@me but i got wrong answer
@me
but i got wrong answer through above logic
Lovely Aprill fool prank !
Lovely Aprill fool prank ! You nearly got me :P
if b can be zero?
if b can be zero?
@Chirayu the question says
@Chirayu
the question says positive numbers
@admin..Learn some algebra
@admin..Learn some algebra before posting problems like this. Read Fermat's last theorem which states that a^n+b^n=c^n is not possible for n>2. Or change the question to find real numbers instead of integers.
@kinshuk "learn algebra" real
@kinshuk "learn algebra" real numbers have too many solutions :P and there is no smallest positive a :P
Just a general comment...
Just a general comment... Fermat's last Theorem is one conjuncture which was called a "theorem" even before it was proved... and the Poincaré conjuncture is still called a "conjuncture" (it's proved)...
watz wrong wit u
watz wrong wit u guys...?
did anyone hack dis site n driving the users AWAY from this site or wat...?!!!
i had a lot of respect towards this site but now u r loosing that...
hope u will rectify everything...
n y r the previous winners
n y r the previous winners of old contests not working on this contest....?
hey buddies have a look on this point...
@admin: when will the actual
@admin: when will the actual contest start?? We are all waiting!!!