Skip to main content

URI Problem 1930 Solution Electrical Outlet - URI Online Judge Solution


URI Online Judge Solution 
1930 Electrical Outlet Using Python Programming Language. 

Finally, the team from the University managed to qualify for the Finals of the SBC Programming Marathon. The three members of the team and their coach are looking forward to represent the university, and besides trainining very much, prepare with every detail your trip to São Paulo, where will be held the National Final.
They plan to carry with them all their electronic devices: mobile phone, tablet, laptop, wifi hotspot, camera, etc, and know they will need several power outlets to connect all these devices. They were told that the four will be in the same hotel room, but have been advised that in each room there is only one available power outlet.
Prevented, the three members of the team and the coach bought each a power strip, thus connect several devices at one outlet of the hotel room; they may also connect one another in strip to further increase the number of available sockets. However, as the rules have many outlets, they asked you to write a program that, given the number of outlets in each rule, determine the maximum number of devices that can be connected to the energy in the same instant.
Input
The input consists of a line with four integers T1, T2, T3, T4, indicating the number of taken from each of the four strips (2 ≤ Ti ≤ 6).
Output
Your program should produce a single line containing a single integer indicating the maximum number of devices that can be connected to the energy in the same instant.
Input ExampleOutput Example

2 4 3 2

8

6 6 6 6

21

2 2 2 2

5

Solution Using Python:

A, B, C, D = map(int, input().split())
S = A-1 + B-1 + C-1 + D
print(S)

Comments

Popular posts from this blog

URI Problem 1001 Solution Extremely Basic - - URI Online Judge Solution

URI Online Judge Problem 1001 Extremely Basic Solution using C, Python Programming Language. Read 2 variables, named  A  and  B  and make the sum of these two variables, assigning its result to the variable  X . Print  X  as shown below. Print endline after the result otherwise you will get “ Presentation Error ”. Input The input file will contain 2 integer numbers. Output Print the letter  X  (uppercase) with a blank space before and after the equal signal followed by the value of X, according to the following example. Obs.: don't forget the endline after all. Samples Input Samples Output 10 9 X = 19 -10 4 X = -6 15 -7 X = 8 URI 1001 Solution in Python A = int(input()) B = int(input()) X = A + B print("X =",X); URI 1001 Solution in C: #include int main() { int A,B,X; scanf ("%d %d", &A, &B); X=A+B; printf("X = %d\n",X); return 0; }

URI Online Judge Solution 1069 Diamonds and Sand

URI Online Judge Solution 1069  Diamonds and Sand using Python Programming Language. John is working in a diamond mine, trying to extract the highest number of diamond "<>". He must exclude all sand particles found "." in this process and after a diamond can be extracted, new diamonds can be formed. If he has as an input. <... << .. >> ....> .... >>>. three diamonds are formed. The first is taken from <..> resulting. <... <> ....> .... >>>. The second diamond is then removed, leaving. <.......> .... >>>. The third diamond is then removed, leaving at the end ..... >>>. without the possibility of extracting new diamonds. Input Read an integer N that is the number of test cases. Then follows N lines each up to 1000 characters, including "<" ,">" and "." Output You must print the amount of diamonds that can be extrated in each test ca...

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