Friday, November 24, 2017

Pet Kattis Problem Solution In Java


//Nayeem Shahriar Joy,Applied Physics & Electronic Engineering, University of Rajshahi.
 
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import javax.swing.text.html.HTMLDocument.Iterator
 
public class Joy{
public static void main(String[] args) {
// Get input from the user w/ sentinel logic
Scanner io = new Scanner(System.in);
int index=0;
int sum=0,sum1 = 0;
for(int i=1;i<=5;i++)
{
int a=io.nextInt();
int b=io.nextInt();
int c=io.nextInt();
int d=io.nextInt();
sum=a+b+c+d;
if(sum1<=sum)
{
sum1=sum;
index=i;
}
}
System.out.println(index+" "+sum1);
}
}

No comments:

Post a Comment