HACKER RANK Project Euler 13 - Large Sum - Solution.'Py'

Project Euler Challenges-13 - Large Sum Solution
Problem Statement
This problem is a programming version of Problem 13 from projecteuler.net
Work out the first ten digits of the sum of N 50-digit numbers.
Input Format 
First line contains N, next N lines contain a 50 digit number each.
Output Format 
Print only first 10 digit of the final sum
Constraints 
1N103
Sample Input
5
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
Sample Output
2728190129


Solution:

# Enter your code here. Read input from STDIN. Print output to STDOUT
a = input()
sum = 0
while (a>0):
    a-=1
    b = input()
    sum = sum + b
    
print str(sum)[0:10]

Thanks for Visiting, Hope this helps you....

Comments

Popular Posts