0% found this document useful (0 votes)
36 views1 page

prob-D-Another Problem

The document describes a programming problem from the 2020 ICPC Vietnam Southern Provincial Programming Contest. The problem involves taking two large input numbers a and b, multiplying all numbers from a to b, summing the digits of the resulting number x, and repeating this process of summing digits until the sum is less than 10, at which point the final sum is printed as the output.

Uploaded by

Thu Hằng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views1 page

prob-D-Another Problem

The document describes a programming problem from the 2020 ICPC Vietnam Southern Provincial Programming Contest. The problem involves taking two large input numbers a and b, multiplying all numbers from a to b, summing the digits of the resulting number x, and repeating this process of summing digits until the sum is less than 10, at which point the final sum is printed as the output.

Uploaded by

Thu Hằng
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

The 2020 ICPC Vietnam Southern Provincial

Programming Contest
University of Science, VNU-HCM
October 25, 2020

Problem D
Another Problem
Time Limit: 1 seconds
Memory Limit: 1024 megabytes

Phidang thinks that the first problem to test the candidates is too
simple and easy. Therefore, he wants to give another problem with
numbers. The problem is as follows.

There are two extremely large numbers 𝑎 and 𝑏. Phidang asks the
candidates to compute the multiplication of all the numbers in the
interval [𝑎, 𝑏]. Let the result of the multiplication is 𝑥. Now, the
candidates have to do the following process to find the result.

1. Calculate the sum of all digits of 𝑥.

2. If the sum is less than 10, print it.

3. Otherwise, repeat the process with 𝑥 is now the sum of all digits of 𝑥.

Input
The input contains two lines corresponding to the two numbers 𝑎 and (1 ≤ 𝑎 ≤ 𝑏 ≤ 10100 000 ,
each lies on one line.

Output
The output contains a single number, which is the result of the above process.

Sample Input Sample Output


1 3
5
6 3
8
5 9
68

You might also like