Advertisement
Alex8433

Стоянка

Apr 30th, 2021
782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.88 KB | None | 0 0
  1. fun main () {
  2.     val hours = readLine()!!.toInt()
  3.     var total = 0.0
  4.  
  5.     when {
  6.         hours <=5 -> {
  7.             total += hours
  8.             println(total)
  9.         }
  10.         hours in 6..23 -> {
  11.             val  y= (hours-5)*0.5
  12.             total =(y+5)
  13.             println(total)
  14.         }
  15.         hours >= 24 && hours % 24 !=0 && hours <48-> {
  16.             val z = (hours-24)*0.5
  17.             total=(z+15)
  18.             println( total)
  19.  
  20.         }
  21.         hours>=48 && hours % 24 ==0 -> {
  22.             val v= hours /24
  23.             total = (v*15).toDouble()
  24.             println(total)
  25.         }
  26.         hours >48 && hours % 24 !=0 ->{
  27.             val k = hours /24
  28.             val m = k*24
  29.             val d = hours - m
  30.             val j = d*0.5
  31.             val l = k*15
  32.             total= l+j
  33.             println(total)
  34.         }
  35.     }
  36. }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement