Skip to main content

Posts

Showing posts with the label Beginner

URI Problem 2936 Solution How Much Cassava? - URI Online Judge Solution

URI Online Judge Solution 2936 How Much Cassava? Using Python Programming Language. Every year in April, the Curupira, Boitatá, the pink Boto (this one in his man form, as Dona Chica likes it better), Mapinguari and Iara meet at Dona Chica to remember their moments with Mani, the beautiful girl with the white skin. And as it could not be different the main dish of this meeting is the cassava. Each one of them eats one to ten servings of cassava and they always warn Dona. Chica in advance about how many servings they will eat that day. The size of the portion of each is different, but they are always the same. The portions are as follows (in grams):  Curupira eats 300  Boitatá eats 1500  Boto eats 600  Mapinguari eats 1000  Iara eats 150    Dona chica in turn always eats 225 grams of cassava. Tired of every year having to figure out how much cassava to prepare she contacted you to write a program that tells how much cassava should be prepared in grams. ...

URI Problem 2896 Solution Enjoy the Offer - URI Online Judge Solution

URI Online Judge Solution 2896 Enjoy the Offer Using Python Programming Language. A supermarket is doing a sales promotion for soft drinks. If one day you buy soft drinks and bring the empty bottles the next day, they exchange each set of K empty bottles for a full one. A customer wants to make the most of this offer and therefore bought several bottles on the first day of the promotion. Now he wants to know how many bottles he will have at the end of the second day of the promotion if he use it to the fullest.  Make a program to calculate this.  Input   The first input line contains integer T (1 ≤ T ≤ 10000), which indicates the number of test cases. In each of the following T lines come two integers N and K (1 ≤ K, N ≤ 10000), respectively the number of soft drinks bought and the number of empty bottles to gain a full.  Output   For each test case print the number of bottles that the customer will have on the second day, if he makes the most of the offer. Inpu...

URI Problem 2867 Solution Digits - URI Online Judge Solution

URI Online Judge Solution 2867 Digits Using Python Programming Language.   Given two integers, n and m , how many digits have  n m   ?  Examples:  2 and 10 - 210 = 1024 - 4 digits 3 and  9 - 39 = 19683 - 5 digits  Input   The input is composed of several test cases. The first line has an integer C, representing the number of test cases. The following C lines contain two integers N and M (1 <= N, M <= 100).  Output   For each input test case of your program, you must print an integer containing the number of digits of the result of the calculated power in the respective test case. URI 2867 Solution in Python: T = int(input()) while T>0: A,B = map(int,input().split()) A = A**B A = len(str(A)) print(A) T-=1

URI Problem 2861 Solution The Output - URI Online Judge Solution

URI Online Judge Solution 2861 The Output Using Python Programming Language.   Cacunda, Bizz and Massacote are inseparable friends. In college, in a few days, they did not go to class to play tricks. One day a teacher was passing by. At the same time, the three of them shouted the word "gzuz" loudly. After this cry, they became invisible, and the teacher did not see them. Again, their class was answering questions from the teacher. When it was the turn of one of them, they would respond with the word "gzuz", and the teacher would accept the answer and give the maximum mark of the question. Make the simulation of the output they found to get out of the most diverse problems.  Input  The input is composed of several test cases. The first line contains an integer C (2 <= C <= 99) relative to the number of questions the teacher has asked. The following C lines come with a question asked by the teacher.  Output   For each question, print the answer that was sa...

URI Problem 2791 Solution Bean - URI Online Judge Solution

URI Online Judge Solution 2791 Bean Using Python Programming Language.  It is said in the surroundings of Montes Claros that, long ago in the municipal market, Sebastião and his companions of work always play a game of divination after the delivery of agricultural products harvested in the week that happened. The game, "Guess Where the Bean is", consists in hiding a grain of beans in one of four opaque glasses, and after shuffling them, the bettor must guess in which glass the vegetable is.  This year, due to the great cultural and historical success and the enormous amount of people who practice this game in the municipal market, the city council decided to hold a "Guess Where the Bean is '' championship. However, she needs a program to show viewers where the beans were after the end of a game. Knowing that the next Programming Marathon will take place in the city, she soon commissioned a solution from the excellent programmers. In this way, you should assist th...

URI Problem 2787 Solution Chess - URI Online Judge Solution

URI Online Judge Solution 2787 Chess Using Python Programming Language.  In the chessboard, the square of the board on line 1, column 1 (upper left corner) is always white and the colors of the houses alternate between white and black, according to the pattern known as ... chess! In this way, since the traditional board has eight rows and eight columns, the house on row 8, column 8 (lower right corner) will also be white. In this problem, however, we want to know the color of the square of the board in the lower right corner of a tray with any dimensions: L rows and C columns. In the example of the figure, for L = 6 and C = 9, the square of the board in the lower right corner will be black!  Input   The first line of the input contains an integer L (1 ≤ L ≤ 1000) indicating the number of lines in the chessboard. The second line of the input contains an integer C (1 ≤ C ≤ 1000) representing the number of columns.  Output   Print a line on the output. The line sho...

URI Problem 2764 Solution Date Input and Output - URI Online Judge Solution

URI Online Judge Solution 2764 Date Input and Output Using Python Programming Language.   Your teacher would like to make a program with the following characteristics: Read a date in the DD/MM/YY format; Print the date in MM/DD/YY format; Print the date in the YY/MM/DD format ; Print the date in DD-MM-YY format.  Input   The input consists of several test files. In each test file there is one line. The line has the following DD/MM/YY format where DD, MM and YY are integers. As shown in the following input example.  Output   For each file in the entry, you have an output file. The output file has three lines according to procedures 2, 3, and 4. As shown in the following output example. Input Samples Output Samples 02/08/10 08/02/10 10/08/02 02-08-10 29/07/03 07/29/03 03/07/29 29-07-03 URI 2764 Solution in Python: D = input() DD = D[0]+D[1] MM = D[3]+D[4] YY = D[6]+D[7] print(MM+'/'+DD+'/'+YY) print(YY+'/'+MM+'/'+DD) print(DD+'-'+MM+'-'+...

URI Problem 2756 Solution Output 10 - URI Online Judge Solution

URI Online Judge Solution 2756 Output 10 Using Python Programming Language.  Your programming teacher would like you to do a program with the following characteristics:  Put seven blanks and put the 'A' character;  Put six blanks and place the character 'B', a space and the character 'B';  Put five blanks and place the 'C' character, three white space, and the 'C' character;  Put four blanks and place the 'D' character, five white space, and the 'D' character;  Put three blanks and put the 'E' character, seven white space and the 'E' character;  Repeat procedure 4;  Repeat procedure 3;  Repeat procedure 2;  Repeat procedure 1.  Input   There is not.  Output   The result of your program should be written according to the output example. Input Sample Output Sample A B B C C D D E E D D C C B B A   URI 2756 Solution in Python: print(" A...

URI Problem 2753 Solution Output 7 - URI Online Judge Solution

URI Online Judge Solution 2753 Output 7 Using Python Programming Language.   Your teacher would like you to do a program with the following characteristics:  Create twenty-six integers;  Assign the first variable the value 97;  Assign the other variables to the value of the first sum of a unit;  Show on the screen the numeric values of the first variable, a space in arm, the character 'e', another white space and its alphanumeric value (characters);  Repeat for all other variables.  Input  There is not.  Output  The result of your program should be the same as the output example. Input Sample Output Sample 97 e a 98 e b 99 e c 100 e d 101 e e 102 e f 103 e g 104 e h 105 e i 106 e j 107 e k 108 e l 109 e m 110 e n 111 e o 112 e p 113 e q 114 e r 115 e s 116 e t 117 e u 118 e v 119 e w 120 e x 121 e y 122 e z URI 2753 Solution in Python: print("97 e a") print("98 e b") print("99 e c") print("100 e d") print("101 e e") print(...

URI Problem 2748 Solution Output 2 - URI Online Judge Solution

URI Online Judge Solution 2748 Output 2 Using Python Programming Language.  Your teacher would like to make a screen with the following characteristics:  Have 39 dashes (-) on the first line;  Have a | underneath the first dash and the thirty-ninth dash of the first line, below the dash should begin to write the word "Roberto" and the rest fill in the middle with white space;  Have a | below the first dash and the thirty-ninth dash of the first line, fill in the middle with whitespace;  Have a | below the first dash and the thirty-ninth dash of the first line, below the 10 dash you should begin to type the number "5786" and the rest fill in the middle with whitespace;  Repeat procedure 3;  Have a | underneath the first dash and the thirty-ninth dash of the first line, below the dash 10 should begin to write the word "UNIFEI" and the rest fill in the middle with white space;  Repeat procedure 1.    At the end should look like the followin...

URI Problem 2747 Solution Output 1 - URI Online Judge Solution

URI Online Judge Solution 2747 Output 1 Using Python Programming Language.  Your programming teacher would like to make a screen with the following characteristics:  Have 39 dashes (-) on the first line;  Have a | below the first dash and the thirty-ninth dash of the first line, fill in the middle with whitespace;  Repeat procedure 2 plus four times;  Repeat procedure 1.  At the end should look like the following image:  --------------------------------------- (39 traces) | | | | | | | | | | --------------------------------------- (39 traces) Input   There is no.  Output  The output will be printed as shown above. Input Sample Output Sample --------------------------------------- | | | | | ...

URI Problem 2708 Solution Tourists in the Huacachina Park - URI Online Judge Solution

URI Online Judge Solution 2708 Solution Tourists in the Huacachina Park Using Python Programming Language.   The municipal tourism agency of the city of Ica in Peru has set up a checkpoint for adventure jeeps that ascend to the dunes of Hucachina Park. As during the day, there are several off-roads that go up and down the national park, and tourists do not always use the same transportation for the round trip, the city hall needed to have better control and security over the flow of visitors in the park. Develop a program that receives as input if a jeep is entering or returning from the park and the amount of tourists this vehicle is transporting. At the end of the shift, the program must indicate how many vehicles and tourists are still missing from the adventure.  Input   The program must receive successive input pairs. Each pair should indicate the jeep's movement and the amount of tourists it is carrying. The first entry should be "SALIDA" or "VUELTA". ...

URI Problem 2702 Solution Hard Choice - URI Online Judge Solution

URI Online Judge Solution 2702 Hard Choice Using Python Programming Language.   In long flights, airlines offer hot meals. Usually the flight attendants push carts containing the meals down along the aisles of the plane. When a cart reaches your row, you are asked right away: “Chicken, beef, or pasta?” You know your choices, but you have only a few seconds to choose and you don’t know how your choice will look like because your neighbor hasn’t opened his wrap yet. . .  The flight attendant in this flight decided to change the procedure. First she will ask all passengers what choice of meal they would prefer, and then she will check if the number of meals available in this flight for each choice are enough.  As an example, consider that the available number of meals for chicken, beef and pasta are respectively (80, 20, 40), while the number of passenger’s choices for chicken, beef and pasta are respectively (45, 23, 48). In this case, eleven people will surely not receive ...

URI Problem 2581 Solution I am Toorg! - URI Online Judge Solution

URI Online Judge Solution 2581 I am Toorg! Using Python Programming Language. Toorg is the wisest member of the group of heroes called The Protectors of the Milky Way. For any question, it has the ideal answer! Write a program that, given a question, tells Toorg's answer. Input The input will have several test cases. For each test case, a N number is displayed, which represents the number of test cases. Then there will be N lines, with questions asked for Toorg. Output For each test case, print Toorg's answer. Input Sample Output Sample 3 Who are you? How old are you? What can I do for you? I am Toorg! I am Toorg! I am Toorg! URI 2581 Solution in Python: T = int(input()) while T>0: A = input() print("I am Toorg!") T-=1

URI Problem 2483 Solution Merry Christmaaas! - URI Online Judge Solution

URI Online Judge Solution 2483 Merry Christmaaas! Using Python Programming Language. You get so happy at Christmas that you want to scream at everyone: "Merry Christmas!!". To put all this happiness out, you've wrote a program that, given an I index of happiness, your Christmas scream is more lively. Input The input consists of an integer I (1 < I ≤ 104) that represents that happiness index. Output The output consists of the phrase "Feliz natal!" ("Merry Christmas" in Portuguese), and the last a of the sentence is repeated I times. A line break is necessary after printing the sentence. Input Sample Output Sample 5 Feliz nataaaaal! URI 2483 Solution in Python: N = int(input()) S = "Feliz nat" for i in range(N): S += 'a' S = S + 'l!' print(S)

URI Problem 2344 Solution Tasting Notes - URI Online Judge Solution

URI Online Judge Solution 2344 Tasting Notes Using Python Programming Language.   Rosy is a talented high school teacher who has won many awards for the quality of her class. Her recognition was such that she was invited to teach at a school in England. Even speaking English well, Rosy was a little apprehensive about the responsibility, but decided to accept the proposal and face it as a good challenge. Everything went well for Rosy until the day of the race. Accustomed to giving grades from 0 (zero) to 100 (one hundred), she did the same in the first test of students from England. However, the students found it strange, because in England the rating system is different: grades should be given as concepts from A to E. Concept A is the highest, while concept E is the lowest. Talking to other teachers, she received the suggestion to use the following table, relating the numeric notes to the concept notes: The problem is that Rosy has already given the notes in the numerical syst...

URI Problem 2234 Solution Hot Dogs - URI Online Judge Solution

URI Online Judge Solution 2234 Hot Dogs Using Python Programming Language.   In 2012 it was achieved a new world record in the famous Competition Hot Dogs Nathan: the champion, Joey Chestnut devoured 68 hot dogs in ten minutes, an increase amazing compared to 62 sandwiches devoured by the same Chestnut in 2011. Nathan's Famous Corporation restaurant, located in Brooklyn, NY, is responsible for the competition. They produce delicious hot dogs, world famous, but when it comes math is they are not as good. They wish to be listed in the Guinness Book of Records, but they should fill out a form describing the basic facts of the competition. In particular, they must inform the average number of hot dogs consumed by participants during the competition. You can help them? They promised to pay it with one of their tasty hot dogs. Given the total of hot dogs consumed and the total of participants in the competition, you should write a program to determine the average number of hot dogs consu...

URI Problem 2143 Solution The Return of Radar - URI Online Judge Solution

URI Online Judge Solution 2143 The Return of Radar   Using Python Programming Language.   Every year after the contest that takes place in Taxiland, contestants and coaches go to the famous and renowned restaurant Radar. However, the waiters (always very kind and polite) get overwhelmed due to the amount of people, and therefore, end up taking a while to serve them. Contestants or coaches who sit at the ends are the lucky ones, because they order only once and are served right away, but the others must always order twice, because the waiters (always very kind and polite) are careless and easily forget the orders. Besides, there's a superstition going on among the contestants and coaches that if there's not an even amount of people who don't sit at the ends, none of the university's teams will win the next contest. So your task is to determine the sum of the number of of orders of each one to know if it's worth going to Radar. But whatever the result is, remember: it...

URI Problem 2006 Solution Identifying Tea - URI Online Judge Solution

URI Online Judge Solution  2006 Identifying Tea  Using Python Programming Language.   Blind tea tasting is the skill of identifying a tea by using only your senses of smell and taste. As part of the Ideal Challenge of Pure-Tea Consumers (ICPC), a local TV show is organized. During the show, a full teapot is prepared and five contestants are handed a cup of tea each. The participants must smell, taste and assess the sample so as to identify the tea type, which can be: (1) white tea; (2) green tea; (3) black tea; or (4) herbal tea. At the end, the answers are checked to determine the number of correct guesses. Given the actual tea type and the answers provided, determine the number of contestants who got the correct answer. Input The first line contains an integer T representing the tea type (1 ≤ T ≤ 4). The second line contains five integers A, B, C, D and E, indicating the answer given by each contestant (1 ≤ A, B, C, D, E ≤ 4). Output Output a line with an integer repres...