Guest User

Untitled

a guest
Apr 1st, 2020
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. namespace Forum
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. Console.ReadLine();
  11.  
  12. string[] array = Console.ReadLine().Split(' ');
  13.  
  14. BigInteger oddProduct = 1;
  15. BigInteger evenProduct = 1;
  16.  
  17. for (int i = 0; i < array.Length; i++)
  18. {
  19. if (i % 2 == 0)
  20. {
  21. evenProduct *= BigInteger.Parse(array[i]);
  22. }
  23.  
  24. else
  25. {
  26. oddProduct *= BigInteger.Parse(array[i]);
  27. }
  28. }
  29.  
  30. if (oddProduct == evenProduct)
  31. {
  32. Console.WriteLine("yes " + oddProduct);
  33. }
  34. else
  35. {
  36. Console.WriteLine("no " + evenProduct + " " + oddProduct);
  37. }
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment