URI Problem (Game Time) 1046 Solution in Java

Problem Solving, URI

URI Problem (Game Time) 1046:
Game Time is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.

import java.util.Scanner;

/**
 * @Author : Muhammad Harun-Or-Roshid
 * @Date : Oct 12, 2016
 * @Time : 2:10:33 PM
 */
public class Uri1046 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int start, end, duration = 0;
        start = sc.nextInt();
        end = sc.nextInt();
        if (start <= 24 && end <= 24 && start >= 0 && end >= 0) {
            if (end > start) {
                duration = end - start;
            } else if (end < start || end == start) {
                duration = (end - start) + 24;
            }
            System.out.println("O JOGO DUROU "+duration+" HORA(S)");
        }
    }
}

0 Comments

You may find interest following article