Peter and Casino Hotel Royal Gardenia has arranged for an elite business party for the lead industrialists and celebrities of the City. Followed by a dinner buffet, the Event coordinators planned for some casino game events for the high-toned crowd. Peter was a visitor at the party and he takes some number of rubles to the casino with the intention of becoming rich. He plays three machines in turn. Unknown to him, the machines are entirely predictable. Each play costs one ruble. The first machine pays 20 rubles every 25th time it is played; the second machine pays 80 rubles every 120th time it is played; the third pays 8 rubles every 12th time it is played. Given the number of rubles with Peter initially (there will be at least one and fewer than 1000), and the number of times each machine has been played since it last paid, write a program that calculates the number of times Peter plays until he goes broke. Input Format: First line of the input is an integer that correspo...
Posts
Showing posts from February, 2022
- Get link
- X
- Other Apps
Lucky Cards The Hatfield Game Fair is the premier event of its kind for adults interested in some intellectual and cognitive brain games. Exciting games were organized for kids between age group of 8 and 10. One such game was the "Lucky Cards", a simple two-player game, played with a deck of cards. The cards in the deck have these possible names: two, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace . The cards labeled jack, queen, king, ace are collectively known as high cards . The numerical equivalent of the high cards is as given below: Jack – 11 Queen – 12 King – 13 Ace - 1 Please note here, though Ace has a numerical equivalent value as 1, it is always considered as the top rated card. So it is also included in the list of high cards. The game organizer selects N cards and places it in the deck faced-down on the table. Player A turns over the top card and places it on a pile; then player B turns over the to...
- Get link
- X
- Other Apps
Maths Challenge In connection to the International Mathematics Day celebration, the Mathematical Scholars Society had arranged for a Maths Challenge Event where school students participated in large numbers. The first level of the challenge was an oral quiz, followed by a written test in the second round. In the second round, the problem that the students had to answer, goes like this: For every positive number ‘n’ we define a function streak(n)=k as the smallest positive integer k such that n+k is not divisible by k+1. For example: 13 is divisible by 1 14 is divisible by 2 15 is divisible by 3 16 is divisible by 4 17 is NOT divisible by 5 So streak(13)=4. Similarly: 120 is divisible by 1 121 is NOT divisible by 2 So streak(120)=1. Now, define P(k, N) which will give the number of integers n , 1<n<=N , for which streak(n) = k . Write a program to get the input as 'k' and 'N' and, find the count of integers until N which has the st...
- Get link
- X
- Other Apps
Hanging Bridge At the annual "KrackerJack Karnival", there was a newest attraction ever in the City, the "Hanging Bridge". Visitors will be able to walk 200ft on the bridge, hanging around 50ft above the ground, and enjoy a wide-angle view of the breathtaking greenery. The Hanging Bridge was inaugurated successfully in co-ordination with the Event Manager Rahul. There is a limit on the maximum number of people on the bridge and Rahul has to now ensure the count of people on the bridge currently should not exceed the limit. He then approximately estimated that C adults and D kids who came to the show, were on the hanging bridge. He also noticed that there are L legs of the people touching the bridge. Rahul knows that kids love to ride on the adults and they might ride on the adults, and their legs won't touch the ground and hence he would miss counting their legs. Also Rahul knew that the adults would be strong enough to ride at max two k...
- Get link
- X
- Other Apps
Aayush's Scholarship Aayush studies in Teswan National University. Now is the time for exam results. Aayush similar to other students, hopes that his scores in 5 subjects in the exam could fetch him a scholarship for his GRE preparation. The following simple rules are used to find whether he is eligible to receive scholarship: University follows 5 point grading system. In an exam, a student can receive any score from 2 to 5. 2 is called an F grade, meaning that student has failed that exam. Student should not have fail any of the exams. Student must obtain a full score in some of his/her exams to show that he/she is excellent in some of the subjects. He/She must have a grade point average not less than 4.0 You are given information regarding how Aayush performed in those 5 subjects . Help him determine whether he will receive the scholarship or not. Input Format: The input contains 5 space separated integers denoting Aayush’s 5 ...