G2A Many GEOs
SHARE
TWEET

Untitled

nassss Apr 1st, 2020 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace OddAndEvenProducts
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int n = int.Parse(Console.ReadLine());
  11.  
  12.             int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  13.             int oddSum = 1;
  14.             int evenSum = 1;
  15.  
  16.             for (int i = 1; i < n; i++)
  17.             {              
  18.  
  19.                 if (i % 2 == 1)
  20.                 {
  21.                     oddSum *= array[i];
  22.                 }
  23.                 else
  24.                 {
  25.                     evenSum *= array[i -1];
  26.                 }
  27.             }
  28.             if (evenSum == oddSum)
  29.             {
  30.                 Console.WriteLine($"yes {evenSum}");
  31.             }
  32.             else
  33.             {
  34.                 Console.WriteLine($"no {oddSum} {evenSum}");
  35.             }
  36.         }
  37.     }
  38. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top