Plus
Pin


Problem description Progress
ID 42693. Big numbers
Темы: Strings    Data types   

Let S(n) be the sum of the decimal digits of the integer n. For example, S(123)=1+2+3=6.

Given two three-digit integers A and B, find the greater of S(A) and S (B).

Input
The input is a single string containing two integers A and B (100 <= A, B <= 999).

Imprint
Print the larger value of S(A) and S(B). If they are equal, print S(A).

Please note that division operations cannot be used when solving the problem.

Examples
# Input Output
1 123 234 9

ID 42694. 2 in 2007
Темы: Data types   

Write a program that evaluates the expression 22007. Print in the first line a string representing the number formed by the digits at the positions with indices 20, 0 and 7 of the calculated value . On the second line print the sum of the digits in the same positions. Numbering of digits starts from the left from zero.

ID 42698. Copy n-ok
Темы: Data types    Strings   

Let  \(N(n,k) = n+\overline{nn}+\overline{nnn} + ... +\underbrace{\overline{n..n }}_{k}\). Given the value n and k, calculate the value N(n, k).

Input
The program receives two lines as input. The first line contains a natural number n (1<=n<=9), the second line contains a natural number k (1 <= k <= 10).

Imprint
Display N(n, k) as an expression and an answer.
 

Examples
# Input Output
1
1
3
1+11+111=123

ID 42835. Operations with real numbers. Module math
Темы: Data types    Real numbers   

Write a program that calculates the square root of a number entered from the keyboard, accurate to three decimal places.
The input is a real number.
Example
Input
25.
Output
5.000