SimeonTs

SUPyF2 D.Types and Vars Exercise - 09. Snowballs

Sep 27th, 2019
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.24 KB | None | 0 0
  1. """
  2. Data Types and Variables - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1722#8
  4.  
  5. SUPyF2 D.Types and Vars Exercise - 09. Snowballs (not included in final score)
  6.  
  7. Problem:
  8. Tony and Andi love playing in the snow and having snowball fights, but they always argue which makes the best snowballs.
  9. They have decided to involve you in their fray, by making you write a program,
  10. which calculates snowball data, and outputs the best snowball value.
  11. You will receive N – an integer, the number of snowballs being made by Tony and Andi.
  12. For each snowball you will receive 3 input lines:
  13. • On the first line you will get the snowballSnow – an integer.
  14. • On the second line you will get the snowballTime – an integer.
  15. • On the third line you will get the snowballQuality – an integer.
  16. For each snowball you must calculate its snowballValue by the following formula:
  17. (snowballSnow / snowballTime) ^ snowballQuality
  18. At the end you must print the highest calculated snowballValue.
  19. Input
  20. • On the first input line you will receive N – the number of snowballs.
  21. • On the next N * 3 input lines you will be receiving data about snowballs.
  22. Output
  23. • As output you must print the highest calculated snowballValue, by the formula, specified above.
  24. • The output format is:
  25. {snowballSnow} : {snowballTime} = {snowballValue} ({snowballQuality})
  26. Constraints
  27. • The number of snowballs (N) will be an integer in range [0, 100].
  28. • The snowballSnow is an integer in range [0, 1000].
  29. • The snowballTime is an integer in range [1, 500].
  30. • The snowballQuality is an integer in range [0, 100].
  31. • Allowed working time / memory: 100ms / 16MB.
  32.  
  33. Examples:
  34. Input:
  35. 2
  36. 10
  37. 2
  38. 3
  39. 5
  40. 5
  41. 5
  42. Output:
  43. 10 : 2 = 125 (3)
  44.  
  45. Input:
  46. 3
  47. 10
  48. 5
  49. 7
  50. 16
  51. 4
  52. 2
  53. 20
  54. 2
  55. 2
  56. Output:
  57. 10 : 5 = 128 (7)
  58. """
  59. n = int(input())
  60. best_value = 0
  61. for_print = ""
  62.  
  63. for snow_ball in range(n):
  64.     snowballSnow = int(input())
  65.     snowballTime = int(input())
  66.     snowballQuality = int(input())
  67.     snowballValue = int((snowballSnow / snowballTime) ** snowballQuality)
  68.     if snowballValue > best_value:
  69.         best_value = snowballValue
  70.         for_print = f"{snowballSnow} : {snowballTime} = {snowballValue} ({snowballQuality})"
  71.  
  72. print(for_print)
Add Comment
Please, Sign In to add comment