Guest User

Untitled

a guest
Apr 1st, 2020
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. namespace TelerikTests
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  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 + 1) % 2 == 0)
  20.                 {
  21.                     evenProduct *= BigInteger.Parse(array[i]);
  22.                 }
  23.                 else
  24.                 {
  25.                     oddProduct *= BigInteger.Parse(array[i]);
  26.                 }
  27.             }
  28.  
  29.             if (oddProduct == evenProduct)
  30.             {
  31.                 Console.WriteLine("yes " + oddProduct);
  32.             }
  33.             else
  34.             {
  35.                 Console.WriteLine("no " + oddProduct + " " + evenProduct);
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment