Integers Come In All Sizes in Python HackerRank Solution

Hello Programmers, In this post, you will know how to solve the Integers Come In All Sizes in Python HackerRank Solution. This problem is a part of the HackerRank Python Programming Series.

Ezoicreport this adIntegers Come In All Sizes in Python HackerRank Solution
Integers Come In All Sizes in Python HackerRank Solutions

One more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.

Integers Come In All Sizes in Python HackerRank Solution

Ezoicreport this adproblem

Integers in Python can be as big as the bytes in your machine’s memory. There is no limit in size as there is: 2^31 – 1 (c++ int) or 2^63 – 1 (C++ long long int).As we know, the result of a^b grows really fast with increasing b.
Let’s do some calculations on very large integers.
Task :Read four numbers, a, b, c, and d, and print the result of a^b + c^d.

Input Format :

Integers a, b, c, and d are given on four separate lines, respectively.

Constraints :

  • 1 <= a <= 1000
  • 1 <= b <= 1000
  • 1 <= c <= 1000
  • 1 <= d <= 1000

Output Format :

Print the result of  a^b + c^d on one line.

Sample Input :

9
29
7
27

Sample Output :

4710194409608608369201743232

Note: This result is bigger than 2^63 – 1. Hence, it won’t fit in the long long int of C++ or a 64-bit integer.

Integers Come In All Sizes in Python HackerRank Solutions

# Enter your code here. Read input from STDIN. Print output to STDOUT
a, b, c, d = [int(input()) for _ in range(4)]
print(a ** b + c **

Disclaimer: The above Problem (Integers Come In All Sizes in Python) is generated by Hackerrank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.

Next: Triangle Quest in Python HackerRank Solution

Sharing Is Caring

Leave a Comment

Ezoicreport this ad