Welcome

>>>Welcome to my "CODE BAZAR"
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others
Code marshal
URI online judge
Others

Update ✔✔✔ Upcoming programming book (.pdf) "Programming Contest (data structures and algorithms) by Md. Mahbub Hasan & "Graph Algorithms" by Safayat Asraf "****** Date: 20 March, 2019****Hazrat Ali****

Sunday 30 October 2016

URI Online Judge | 1041 Coordinates of a Point (Solution)


Problem
https://www.urionlinejudge.com.br/judge/en/problems/view/1047


URI Online Judge | 1047

Game Time with Minutes

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
Read the start time and end time of a game, in hours and minutes (initial hour, initial minute, final hour, final minute). Then print the duration of the game, knowing that the game can begin in a day and finish in another day,
Obs.: With a maximum game time of 24 hours and the minimum game time of 1 minute.

Input

Four integer numbers representing the start and end time of the game.

Output

Print the duration of the game in hours and minutes, in this format: “O JOGO DUROU XXX HORA(S) E YYY MINUTO(S)” . Which means: the game lasted XXX hour(s) and YYY minutes.
Input SampleOutput Sample
7 8 9 10O JOGO DUROU 2 HORA(S) E 2 MINUTO(S)
7 7 7 7O JOGO DUROU 24 HORA(S) E 0 MINUTO(S)
7 10 8 9O JOGO DUROU 0 HORA(S) E 59 MINUTO(S)
Solution

#include <stdio.h>
int main()
{
    int a, b, c, g, m, s, temp;
    scanf("%d %d %d", &a, &b, &c);
    g = a;
    m = b;
    s = c;
    if (g < m){
        temp = g;
        g = m;
        m = temp;
    }
    if (m < s){
        temp = m;
        m = s;
        s = temp;
    }
    if (g < m){
        temp = g;
        g = m;
        m = temp;
    }
    printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",s,m,g,a,b,c);
    return 0;
}


No comments:

Post a Comment