Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let n = Number(gets())
- let firstNum = 0
- let secondNum = 0
- let thirdNum = 0
- for (let i = 0; i <= n; i++){
- let currentNum = Number(gets())
- if (currentNum >= firstNum){
- thirdNum = secondNum;
- secondNum = firstNum;
- firstNum = currentNum;
- }else if (currentNum >= secondNum){
- thirdNum = secondNum;
- secondNum = currentNum;
- }else if (currentNum >= thirdNum){
- thirdNum = currentNum;
- }
- }
- print(`${firstNum}, ${secondNum} and ${thirdNum}`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement