Company: HirePro

Difficulty: easy

Problem Statement

Mr. Thomas is a very well-known mathematician. He went to an education fair where he noticed a lot of brilliant students, so by seeing their talent he gave them a problem to solve. The problem was: num = P1 + P2 + ... + PN where each Pi is an integer written in the format XYZ , in which X is the base , Y is the power , and Z — the last digit of Pi — tells how many digits (counted from the right, after Z itself is dropped) make up the power Y . Z itself is not part of the arithmetic. For example, for num = 3011 + 1122 the equation is read as num = 30 1 + 1 12 = 31 : in 3011 the final 1 is Z , so one digit ( 1 ) is the power and 30 is the base; in 1122 the final 2 is Z , so two digits ( 12 ) are the power and 1 is the base. Help the students with a program that solves the given equation. Input Format The first line of input contains the integer N , the total number of operands in the equation. Each of the following N lines contains one integer Pi . Output Format The first and

More HirePro OA questionsInterview experiences