Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _01._Basic_Stack_Operations__
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int[] delimeters = Console.ReadLine().Split().Select(int.Parse).ToArray();
- Func<int, int, bool> isDivisible = (x, y) => x % y == 0;
- List<int> numbers = new List<int>();
- for (int i = 1; i <= n; i++)
- {
- if(delimeters.Where(x=> isDivisible(i, x)).Count() == delimeters.Count())
- {
- numbers.Add(i);
- }
- }
- Console.WriteLine(string.Join(" ",numbers));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement