Skip to main content

Posts

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. Input   The input consists of 5 in
Recent posts

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. Input Sample Output Sample 3

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 said b

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 should contain an integer,

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+'-'+