BDesh is a very peaceful country with a smaller population. Recently a Spider Demon with a dangerous kind of venom found in BDesh. Spider Demon pushed his venom into people’s veins and the people became spider-people. I know you are scared.
But don’t worry, BDesh has a very talented and furious health minister named Zenitsu Agatsuma. He has some psychic power, and using these powers Zenitsu somehow manages to kill the Spider Demon.
Ahh! people are relaxed now and cheering Zenitsu. But the people who already are a spider-people still haven't recovered. To change these spiders into people, Zenitsu tries psychic power again but fails. After a long time, Zenitsu’s friend named Shinobu Kochu came with the glorious news that she invented a vaccine to recover these people. Now it’s time to start the vaccination. The process lasted for days.
After starting the vaccination process it is observed that on i-th day if spider-people come to take vaccine they can only vaccinate number of spider-people and get them fully recovered on that day where is the largest multiple of which less or equal to and the remaining become spider-people forever.
You’re given integers where is the number of spider-people who came to take the vaccine on i-th day. Your task is to determine how many people become spider-people forever from not getting vaccinated if they vaccinate as many people as possible.
The first line will be a single integer indicating the number of test cases. Each of the test cases will contain two integers and . Then the next line will contain integers the number of vaccinated people each day.
You have to output lines in the format “Case X: Y”(without quotes) where is the number of test case and is the total number of people who will become permanently spider-people.
2 5 4 5 100 1 12 15 3 1 13 22 1
Case 1: 5 Case 2: 0
In the first case, on the first day, the maximum people who can get vaccine is . On the second day, everyone can get vaccine as itself is a multiple . On the third day, no one can get vaccine as the largest multiple of less than or equal to is . On the fourth day, everyone can get vaccine as itself is a multiple of . Finally, on the fifth day, only people can get vaccine as it is the largest multiple of less than or equal to .
Login to submit
To solve the problem we need knowledge about how Loop works and some basic arithmetic operations. We...