#ACSL2021S1. ACSL2021S1
ACSL2021S1
PROBLEM: Construct a Numeral Hex Triangle according to the following rules. You will be given three positive integers: s, a starting number, d, a delta (the amount by which to increase each number in the triangle); and r the number of rows. The numbers s and d will be in hexadecimal.
- The first row contains the number s.
- Each of the next rows has one more number than the previous row.
- Each number in the triangle is d more than the previous number in the triangle Here are two examples of Numeral Hex Triangles:
INPUT: There are 5 lines of data. Each line has 3 positive integers, s, d, and r. The numbers are separated by spaces and each is less than 1,000,000. Recall that s and d are in hexadecimal.
OUTPUT: For each line of data, print the sum of all of the numbers on the r-th row of the Numeral HexTriangle, transformed into a single hexadecimal digit. To transform the sum, add the digits in base 16. Ifthat sum is more than one hex digit, continue this process until a single hex digit is reached. For example if the last row were , and the sum is ,. This is more than a single hex digit, so we add
SAMPLE INPUT:
A 9 5
ABC F 4
BAD 50 10
FED ABC 25
184 231 35
SAMPLE OUTPUT:
5
C
A
F
5