Kattis Challenge "Sum of Others"

Published: September 15, 2017 | Last Modified: May 2, 2025

Tags: kattis coding challenge

Categories: Java

Problem

My solution

import java.util.Scanner;
public class SumOfOthers {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String[] temp = sc.nextLine().split(" ");
            int answer = 0;
            for (int i = 0; i < temp.length; i++) {
                answer += Integer.parseInt(temp[i]);
            }
            System.out.println(answer/2);
        }
    }
}