Advertisement
Zhorzh

Untitled

Nov 22nd, 2021
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. let n = Number(gets(0))
  2. let max1 = Number.NEGATIVE_INFINITY
  3. let max2 = Number.NEGATIVE_INFINITY
  4. let max3 = Number.NEGATIVE_INFINITY
  5. for (let i = 1; i <= n; i++) {
  6. let currNum = Number(gets(i))
  7. if (currNum > max1) {
  8. max1 = currNum
  9. }
  10. for (let j = 1; j <= n; j++) {
  11. let currNum1 = Number(gets(j))
  12. if (currNum1 > max2 && currNum1<max1) {
  13. max2 = currNum1
  14. }
  15. for (let k = 1; k <= n; k++) {
  16. let curNum2 = Number(gets(k))
  17. if (curNum2 > max3 && curNum2 < max2) {
  18. max3 = curNum2
  19. }
  20. }
  21. }
  22. }
  23. print(max1 + ', ' + max2 + ' and ' + max3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement