subject

Problema 2018.3.2 - Cheated dice Costica is on vacation and his parents sent him to the country. There he gets terribly bored and looking through his grandfather's closet, he came across a bag full of dice. Having no one to play dice with, but it seemed to him that some of the dice were heavier than the others, Costica chose a dice and started to test it by throwing it with him and noting how many times each face fell. He then tries to figure out whether the dice are rolled or not, considering that the difference between the maximum number of appearances of one face and the minimum number of occurrences (of any other face) should not exceed 10% of the total number of throws.
Requirement
Given a number N of dice rolls and then N natural numbers in the range [1: 6] representing the numbers obtained on the rolls, determine whether the dice is tricked according to the above condition.
Input data
From the input (stdin stream) on the first line reads the natural number N, representing the number of rolls. On the following N lines there is a natural number in the range [1: 6] representing the numbers obtained on throws.
Output data
At the output (stdout stream) a single number will be displayed, 0 or 1, 0 if the dice are normal, and 1 if it is cheated.
ATTENTION to the requirement of the problem: the results must be displayed EXACTLY in the way indicated! In other words, nothing will be displayed on the standard output stream in addition to the problem requirement; as a result of the automatic evaluation, any additional character displayed, or a display different from the one indicated, will lead to an erroneous result and therefore to the qualification "Rejected".
Restrictions and clarifications
1. 10 ≤ N ≤ 100
2. Caution: Depending on the programming language chosen, the file containing the code must have one of the extensions .c, .cpp, .java, or .m. The web editor will not automatically add these extensions and their absence makes it impossible to compile the program!
3. Attention: The source file must be named by the candidate as: . where name is the last name of the candidate and the extension (ext) is the one chosen according to the previous point. Beware of Java language restrictions on class name and file name!
Input data

10
6
6
6
6
6
6
6
6
6
6
Output data
1

Roll the dice 10 times, all 10 rolls produce the number 6. Because the difference between the maximum number of rolls (10) and the minimum number of rolls (0) is strictly greater than 10% of the total number of rolls (10% of 10 is 1), we conclude that the dice are oiled.

Input data
10
1
4
2
5
4
6
2
1
3
3
Output data
0

Throw the dice 10 times and get: 1 twice, 2 twice, 3 twice, 4 twice, 5 and 6 at a time. Because the difference between the maximum number of appearances (two) and the minimum number of occurrences (one) is less than or equal to 10% of the total number of throws (10% of 10 is 1), we conclude that the dice are not deceived.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:10
When you reach a yield sign, yield to cross traffic and before you enter the intersection. a. flash your headlights b. wait for a signal c. wait five seconds d. wait for a safe gap
Answers: 1
question
Computers and Technology, 22.06.2019 10:40
Program using c++ only on visual studio pig is a simple two player dice game, played with one die. the first player to reach or surpass 50 is the winner. each player takes a turn rolling the dice. they add to the pot with each roll, having to decide to roll again and increase the pot, or cash out. the risk being they could lose the amount they’ve accumulated into the pot. the rules for each player’s die roll. 1. roll the dice. a. if user rolled a 1, i. the pot gets set to zero ii. the other player goes to step 1. b. a roll of 2-6 is added to the pot. 2. user can choose to hold or roll again. a. choice roll. return to step 1. b. choice hold. i. increment player score by the pot amount. ii. pot gets set to 0. iii. second player gets to roll and goes to step 1. program requirements: ● before each opponent begins ○ output the score for the person and the computer. ○ output the opponents whose turn is beginning and ask the user to hit enter to continue. ● with each dice roll. ○ output the die value, and amount of the round pot. ○ if it’s the users roll ask if they want to roll again ( r ) or hold ( h ). your program should allow r, r, h or h as valid input. if input is anything else, ask the user again until valid input is obtained. ○ the ai will continue playing until the round pot is 20 or more. ● once a player’s score is greater or equal to 50 then they have won, it will no longer ask if they want to keep rolling the die or not. ● once there is a winner ○ score totals are output along with who the winner was. user or computer ○ player is asked if they want to play again y or n. valid input should be y, y, or n, n. ● when a new game starts the starting roll goes to the player that did not roll last. if the user rolled last in the previous game, then the computer rolls first and vice versa. when the program first begins, the player will make the first roll of the first game. development notes : ● you will need a way to roll dice in your program. the rand() function works well, but returns an integer. if we want numbers 0 – 9 we can get the value modulus 10. ● call srand() with a value to seed it. it’s common to seed it with the current computer clock, include ctime, and then call srand(time(
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
You know the right answer?
Problema 2018.3.2 - Cheated dice Costica is on vacation and his parents sent him to the country. Th...
Questions
question
Mathematics, 02.02.2021 17:20
question
Mathematics, 02.02.2021 17:20
question
Mathematics, 02.02.2021 17:20
question
History, 02.02.2021 17:20
question
Arts, 02.02.2021 17:30
Questions on the website: 13722363