nachiiiketa's blog

By nachiiiketa, history, 5 years ago, In English

I have been trying this problem using C++, but have been unable to solve it. I tried doing in Python3 and it did fine on my Linux Machine, but when I submit it here, its shows me run-time error. Where am I going wrong?

The Code: a = int(input()) b = int(input()) ans = (a ** b) — (b ** a) print((ans))

Link to Problem: https://mirror.codeforces.com/problemsets/acmsguru/problem/99999/112

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Take input this way and try it once a,b=map(int,input().split())

  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thank You very much. Its accepted. Please explain why.

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Since python reads a complete line at once you can't take input separately.we do it using split function