Advertisement
Guest User

Untitled

a guest
Feb 14th, 2022
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // VS Code
  2.  
  3. let arr = [5, 4, 3, 2, 5, 2];
  4. let N = arr[0];
  5. let even = 1;
  6. let odd = 1;
  7.  
  8. for (let i = 1; i <= N; i++) {
  9.     let num = arr[i];
  10.     if (i % 2 === 0) {
  11.         even = even * num;
  12.     } else {
  13.         odd = odd * num;
  14.     }
  15. }
  16.  
  17. if (even === odd) {
  18.     console.log(`yes ${even}`)
  19. } else { console.log(`no ${odd} ${even}`) }
  20.  
  21. // Judge
  22.  
  23. let N = +gets;
  24. let even = 1;
  25. let odd = 1;
  26.  
  27. for (let i = 1; i <= N; i++) {
  28.     let num = +gets();
  29.     if (i % 2 === 0) {
  30.         even = even * num;
  31.     } else {
  32.         odd = odd * num;
  33.     }
  34. }
  35.  
  36. if (even === odd) {
  37.     print(`yes ${even}`)
  38. } else { print(`no ${odd} ${even}`) }
Advertisement
RAW Paste Data Copied
Advertisement