Saturday, April 29, 2017

URI Online Judge solution 1930 \ Electrical in java simple code


URI Online Judge solution 1930 \ Electrical in java simple code


URI Online Judge | 1930

Electrical Outlet

Por Cláudio L. Lucchesi, Fábio D. Moreira BR Brazil
Timelimit: 1
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.

Entrada

The input consists of a line with four integers T1T2T3T4, indicating the number of taken from each of the four strips (2 ≤ Ti ≤ 6).

Saída

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 28
6 6 6 621
2 2 2 25

Solution : URI Online Judge solution 1930 \ Electrical in java simple code

import java.util.Scanner;

public class Main {
 public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  byte t1 = in.nextByte();
  byte t2 = in.nextByte();
  byte t3 = in.nextByte();
  byte t4 = in.nextByte();
  System.out.println(t1 + t2 + t3 + t4 - 3);
 }
}


No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.