Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let [K, N] = gets().split(' ').map(Number);
- let sec = [K];
- for(let i = 1; i < N; i++){
- let curr = sec[i - 1];
- sec.push(curr + 1);
- sec.push(2 * curr + 1);
- sec.push(curr + 2);
- }
- console.log(sec[N-1]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement