Modified Pascal Triangle
All submissions for this problem are available.
Hasil was learning about the properties of the pascal triangles in his number theory class.
Hasil decided to try out a variation of the pascal triangle.
In this triangle the elements where whole numbers such that each row had an odd number of elements.
The elements of each triangle row are in ascending order, such that the first row contains first element and that is 0.Sum of this row is zero and he denotes this sum as F(1), thus F(1) = 0.For the second row, he writes the elements as it has been asked above and denoted the sum of elements as F(2). He realized that the values will be too large. So as to keep the values small, Hasil changed his algorithm. Instead of using F(i), where F(i) denotes the sum of elements in ith row, he will use F(i) = F(i) % 10^5.
Hasil wants to play around with his new sequence. He will give you an integer si(si<=10^5) and an integer se(se<=10^6). You have to output all the terms from F(si) to F(si+se) in non-decreasing order.But printing too many numbers is a hassle.So, if there are more than 100 terms in the output, then print only first 100.
The first line contains an integer T(T<= 50), number of test cases.Each test case contains two positive integers si & se as mentioned.
For each test case, print case number (Check sample output) and then print the terms from F(si) to F(si+se) in ascending order (non-decreasing order). If there are more than 100 terms in the output, then only print the first 100.
Input: 3 50 4 80 2 90 3 Output: Case 1: 6234 42550 57550 73156 89380 Case 2: 4880 43280 82646 Case 3: 32076 33790 82390 82860
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, GO|
Fetching successful submissions
If you are still having problems, see a sample solution here.