Advertisement
Merevoli

Untitled

Jul 13th, 2022
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.99 KB | None | 0 0
  1. AVERAGE
  2.  
  3. It is said that 90% of frosh expect to be above average in their class. You are to provide a reality check.
  4.  
  5. The first line of standard input contains an integer C, the number of test cases. C data sets follow. Each data set begins with an integer, N, the number of people in the class (1 ≤ N ≤ 1000). N integers follow, separated by spaces or newlines, each giving the final grade (an integer between 0 and 100) of a student in the class
  6.  
  7. For each case you are to output a line giving the percentage of students whose grade is above average, rounded to 3 decimal places.
  8.  
  9. 5
  10. 5 50 50 70 80 100
  11. 7 100 95 90 80 70 60 50
  12. 3 70 90 80
  13. 3 70 90 81
  14. 9 100 99 98 97 96 95 94 93 91
  15.  
  16. 40.000%
  17. 57.143%
  18. 33.333%
  19. 66.667%
  20. 55.556%
  21.  
  22.  
  23.  
  24. FUNCTION
  25.  
  26. The function g(N) is defined as follows:
  27.  
  28. If N≤100 then g(N) = g(g(N+11))
  29.  
  30. If N≥101 then g(N) = N - 10
  31.  
  32. Write a program to find g(N).
  33.  
  34. The input tests will consist of a series of positive integers, each integer is at most 1,000,000. There will be at most 250,000 test cases. Each number is on a line on its own. The end of the input is reached when the number ‘0’ is met. The number ‘0’ shall not be considered as part of the test set.
  35.  
  36. The program shall output each result on a line by its own, following the format given in the sample output.
  37.  
  38. 101
  39. 1001
  40. 20
  41. 0
  42.  
  43. G(101) = 91
  44. G(1001) = 991
  45. G(20) = 91
  46.  
  47. MODULO
  48.  
  49. Modulo
  50. Time limit: 1
  51.  
  52. It has begun the SGU Coding Programming Contest! We hope you enjoy the next hours you are going to spend with us, as we hope you have a lot of fun! Good luck!
  53.  
  54. This is the first year of the SGU Coding Club, an extension program whose primary goal is to help the programmers of the Sai Gon University to get readier to face the computational challenges from both academic and corporate worlds. Despite of many issues, we find ourselves very happy with the results we have been achieving.
  55.  
  56. In order to warm you up for this particular contest, we shall ask you to write a program which calculates the quotient and the remainder of the division of two integers, can that be? Recall that the quotient and the remainder of the division of an integer $\mathbf{a}$ by a non-zero integer $\mathbf{b}$ are respectively the only integers $\mathbf{q}$ and $\mathbf{r}$ such that 0 ≤ $\mathbf{r}$ < $\mathbf{|b|}$ and:
  57.  
  58. $$\mathbf{a = b×q+r}$$
  59.  
  60. In case you don't know it, the theorem that guarantees the existence and the uniqueness of the integers $\mathbf{q}$ and $\mathbf{r}$ is known as ‘Euclidean Division Theorem’ or ‘Division Algorithm’.
  61.  
  62. The input consists of two integers $\mathbf{a}$ and $\mathbf{b}$ (-1,000 ≤ $\mathbf{a}$ , $\mathbf{b}$ < 1,000).
  63.  
  64.  
  65. Print the quotient $\mathbf{q}$ followed by the remainder $\mathbf{r}$ of the division of $\mathbf{a}$ by $\mathbf{b}$.
  66.  
  67. 7 3
  68.  
  69. 2 1
  70.  
  71. 7 -3
  72.  
  73.  
  74.  
  75. -2 1
  76.  
  77. -7 3
  78.  
  79. -3 2
  80.  
  81.  
  82.  
  83. WATER SUPPLY
  84.  
  85. Water supply
  86. Time limit: 2
  87.  
  88. Due to the continuous drought that happened recently in some regions of Ho Chi Minh, the city's Committee created an agency to assess the consumption of these regions in order to verify the behavior of the population at the time of rationing. This agency will take some districts (for sampling) and will verify the consumption of the people of the ward and the average consumption per inhabitant of each ward.
  89.  
  90. The input contains a number of test's cases. The first line of each case of test contains an integer $N$ (1 ≤ $N$ ≤ $1 * 10^6$), indicating the amount of properties. The following $N$ lines contains a pair of values $X$ (1 ≤ X ≤ 10) and $Y$ ( 1 ≤ $Y$ ≤ 200) indicating the number of residents of each property and its total consumption ($m^3$). Surely, no residence consumes more than 200 $m^3$ per month. The input's end is represented by zero.
  91.  
  92.  
  93.  
  94. For each case of test you must present the message “n:”, where n is the number of the district in the sequence (1, 2, 3, ...), and then you must list in ascending order of consumption, the people's amount followed by a hyphen and the consumption of these people, rounding the value down. In the third line of output you should present the consumption per person in that town, with two decimal places without rounding, considering the total real consumption.
  95.  
  96. 3
  97. 3 22
  98. 2 11
  99. 3 39
  100. 5
  101. 1 25
  102. 2 20
  103. 3 31
  104. 2 40
  105. 6 70
  106. 2
  107. 1 1
  108. 3 2
  109. 0
  110.  
  111.  
  112. #1:
  113. 2-5 3-7 3-13
  114. 9.00 m3.
  115. #2:
  116. 5-10 6-11 2-20 1-25
  117. 13.28 m3.
  118. #3:
  119. 3-0 1-1
  120. 0.75 m3.
  121.  
  122.  
  123. THREE CITIES
  124.  
  125. There are 3 countries $\mathbf{A}$, $\mathbf{B}$, $\mathbf{C}$ with the number of products in each city respectively $\mathbf{t_A}$, $\mathbf{t_B}$, $\mathbf{t_C}$. Know that each year, cities produce a new quantity of products, as well as export and import products for other countries. The number of products when produced in cities $\mathbf{A}$, $\mathbf{B}$, $\mathbf{C}$ is $\mathbf{p_A}$, $\mathbf{p_B}$, $\mathbf{p_C}$ times the number of products available in each city in the previous year, respectively. The cities then import and export an equal amount of the product existing in that city in the previous year. Your task is to calculate what will be the quantity of production in each country after $\mathbf{n}$ years.
  126.  
  127.  
  128.  
  129. image.png
  130.  
  131. Note:
  132.  
  133. $1 <= n <= 10^{2022}$
  134.  
  135. $100 <= ta, tb, tc <= 10^5$
  136.  
  137. $2 <= pa, pb, pc <= 20$
  138.  
  139.  
  140.  
  141. Testcase:
  142.  
  143. 20%:
  144.  
  145. 1 <= n <= 10^5
  146.  
  147. 100 <= ta, tb, tc <= 10^5
  148.  
  149. 2 <= pa, pb, pc <= 20
  150.  
  151. 20%:
  152.  
  153. 1 <= n <= 10^18
  154.  
  155. 100 <= ta, tb, tc <= 10^5
  156.  
  157. pa = 2, pb = 2, pb = 2
  158.  
  159. 60%:
  160.  
  161. 1 <= n <= 10^2022
  162.  
  163. 100 <= ta, tb, tc <= 10^5
  164.  
  165. 2 <= pa, pb, pc <= 20
  166.  
  167. Input is given from Standard Input in the following format:
  168.  
  169. n
  170.  
  171. tA tB tC
  172.  
  173. pA pB pC
  174.  
  175.  
  176. Print 3 integer $\mathbf{t_A}$, $\mathbf{t_B}$, $\mathbf{t_C}$ after $\mathbf{n}$ years. Because the result may be large, The output must modulo $\mathbf{10^9 + 7}$.
  177.  
  178. Example:
  179.  
  180. n = 2
  181.  
  182. ta = 300, tb = 200, tc = 250
  183.  
  184. pa = 2, pb = 3, pc = 4
  185.  
  186.  
  187.  
  188. After 1 year:
  189.  
  190. ta = 600, tb = 600, tc = 1000
  191.  
  192. And then import and export
  193.  
  194. ta = 450, tb = 750, tc = 1000
  195.  
  196.  
  197.  
  198. After 2 years:
  199.  
  200. ta = 900, tb = 2250, tc = 4000
  201.  
  202. And then import and export
  203.  
  204. ta = 1750, tb = 2200, tc = 3200
  205.  
  206.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement