Advertisement
mazarafa

Uri1047.go

Dec 27th, 2019
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.34 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4.     "fmt"
  5. )
  6.  
  7. func main() {
  8.  
  9.     //inicializando as variaveis
  10.  
  11.     var a int
  12.     var b int
  13.     var c int
  14.     var d int
  15.     var x int
  16.     var y int
  17.    
  18.     fmt.Scanf("%d\n", &a)
  19.     fmt.Scanf("%d\n", &x)
  20.     fmt.Scanf("%d\n", &b )
  21.     fmt.Scanf("%d\n", &y)
  22.    
  23.     if (a == y && b == y && y == x){
  24.         c=x-y
  25.         d=24+a-b
  26.         fmt.Println("O JOGO DUROU", d ,"HORA(S) E %d MINUTO(S)\n",  c)
  27.     }
  28.     else if ( a == b && y > x) {
  29.         c=y-x
  30.         d=a-b
  31.         fmt.Println("O JOGO DUROU", d , "HORA(S) E %d MINUTO(S)\n", c)
  32.     }
  33.     else if ( a == b && x > y){
  34.         c=60-x+y
  35.         d=24-a+b-1
  36.         fmt.Println("O JOGO DUROU", d ,"HORA(S) E %d MINUTO(S)\n",  c)
  37.     }
  38.     else if (x == y && a < b){
  39.         c=0
  40.         d=b-a
  41.         fmt.Println("O JOGO DUROU", d ,"HORA(S) E %d MINUTO(S)\n",  c)
  42.     }
  43.     else if (x == y && a > b){
  44.         c=0
  45.         d=24-a+b
  46.         fmt.Println("O JOGO DUROU", d ,"HORA(S) E %d MINUTO(S)\n",  c)
  47.     }
  48.     else if (b > a && y > x){
  49.         c=y-x
  50.         d=b-a
  51.         fmt.Println("O JOGO DUROU", d ,"HORA(S) E %d MINUTO(S)\n",  c)
  52.     }
  53.     else if (a < b && x > y){
  54.         c=60-x+y
  55.         d=b-a-1
  56.         fmt.Println("O JOGO DUROU", d ,"HORA(S) E %d MINUTO(S)\n",  c)
  57.     }
  58.     else if (a > b && x < y){
  59.         c = y - x
  60.         d = 24 - a -1 + b
  61.         fmt.Println("O JOGO DUROU", d ,"HORA(S) E %d MINUTO(S)\n",  c)
  62.     }
  63.     else if (a > b && x > y){
  64.         c= 60 + y - x
  65.         d= 24 + b - a - 1
  66.         fmt.Println("O JOGO DUROU", d ,"HORA(S) E %d MINUTO(S)\n",  c)
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement