Problem:


Score : 400 points

Problem Statement

Give a pair of integers (A, B) such that A^5-B^5 = X.
It is guaranteed that there exists such a pair for the given integer X.

Constraints

1 \leq X \leq 10^9

X is an integer.

There exists a pair of integers (A, B) satisfying the condition in Problem Statement.

Input

Input is given from Standard Input in the following format:

X

Output

Print A and B, with space in between.
If there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.

A B

Sample Input 1

33

Sample Output 1

2 -1

For A=2 and B=-1, A^5-B^5 = 33.

Sample Input 2

1

Sample Output 2

0 -1



Sample input:
33


Sample output:
2 -1

Submission status: Runtime Error

Solution code:
X = int(input())
five = [0] * 70
five_inv = [0] * 70
for i in range(70):
  five[i] = i ** 5
  five_inv[i] = -five[i]

def check(x):
  for i in range(70):
    if X + five[i] in five:
      B = i
      A = five.index(five[i] + X)
      break
    elif X - five[i] in five:
      B = -i
      A = five.index(-five[i] + X)
      break
    elif X + five[i] in five_inv:
      B = i
      A = -five_inv.index(five[i] + X)
      break
    elif X - five[i] in five_inv:
      B = -i
      A = -five_inv.index(-five[i] + X)
      break
  return "{} {}".format(A,B)

print(check(X))

Submission status: Runtime Error

Solution code:
x = int(input())

z = []
u = []
for a in range(1,100):
    for b in range(-100,100):
        z.append(a**5-b**5)
        u.append((a,b))

for i in range(10**9+1):
    if z[i] == x:
        print(u[i][0],u[i][1])
        break

Submission status: Runtime Error

Solution code:
x = int(input())

j = 1

while 1:
  if x < j ** 5:
    j -=1
    break
  j += 1
a = j
#print(a)
# j or j - 1

f = False
for i in range(a, a + 2):
  a_5 = a ** 5
  #j = 0
  for j in range(0, i + 1):
    if a_5 - j ** 5 == x:
      b = j
      f = not f
      break
    elif a_5 + j ** 5 == x:
      b = -j
      f = not f
      break
      
  if f:
    break
print(a,b)

Submission status: Runtime Error

Solution code:
s = int(input())
#print(s)

N=1000
d=[0]*N


for i in range(N):
  d[i]=i**5
  
for i in range(N):
  for j in range(i,N):
    if (d[i] + d[j] == s) :
      print(i,-j)
      sys.exit
    elif (d[i] - d[j] == s):
      print(i,j)
      sys.exit
    elif (d[j] + d[i] == s):
      print(j,-i)
      sys.exit
    elif (d[j] - d[i] == s):
      print(j,i)
      sys.exit

Submission status: Runtime Error

Solution code:
X=int(input())
Ans=[]
for n in range(80):
    for n1 in range(80):
        n2=n**5+n1**5
        if n2 == X:
            Ans.append(n)
            Ans.append(-1*n1)
            break

if len(Ans)==0:
    for n3 in range(70):
        for n4 in range(70):
            n2=n3**5-n4**5
            if n2 == X:
                Ans.append(n3)
                Ans.append(n4)
                break

print(Ans[0],Ans[1])

Submission status: Runtime Error

Solution code:
x = int(input())
A = [i**5 for _ in range(1500)]
for i in range(1500):
  for j in range(1500):
    if A[i]  == x + A[j]:
      print(A[i],A[j])
      break

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
X = int(input())

ans = ""
for i in range(70):
    for j in range(-70, i, 1):
        if i ** 5 - j ** 5 == X:
            ans = "{} {}".format(i, j)
            break
    if ans != "":
        break

if ans != "":
    print(ans)
else:
    print(aaa)

Submission status: Runtime Error

Solution code:
a = int( x**(1/5) )
b = int( x**(1/5) )
p = a**5-x
q = b**5-x
while abs(p**(1/5)).is_integer()!=True and abs(q**(1/5)).is_integer()!=True:
        a-=1
        b+=1
else:
    if abs(p**(1/5)).is_integer()==True:
        if p>=0:
            print(a,int(p**(1/5)))
        else:
            print(a,int(abs(p**(1/5)))*(-1))
    else:
        if q>=0:
            print(b,int(q**(1/5)))
        else:
            print(b,int(abs(q**(1/5)))*(-1))