Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Numerics;
- namespace OddAndEvenProducts
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- BigInteger oddProduct = 1;
- BigInteger evenProduct = 1;
- int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- for (int i = 0; i < n; i++)
- {
- if (i % 2 == 0)
- {
- oddProduct *= numbers[i];
- }
- else
- {
- evenProduct *= numbers[i];
- }
- }
- if (evenProduct == oddProduct)
- {
- Console.WriteLine($"yes {oddProduct}");
- }
- else
- {
- Console.WriteLine($"no {oddProduct} {evenProduct}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement