Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int[] seq = Console.ReadLine()
- .Split()
- .Select(int.Parse)
- .Distinct()
- .ToArray();
- List<int> nn = new List<int>();
- for (int i = 1; i <= n; i++)
- {
- bool isT = true;
- foreach (int item in seq)
- {
- Predicate<int> isDivisible = x => i % x == 0;
- if (!isDivisible(item))
- {
- isT = false;
- break;
- }
- }
- if (isT)
- {
- nn.Add(i);
- }
- }
- Console.WriteLine(string.Join(' ', nn));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement