You are viewing a single comment's thread. Return to all comments →
Here is my 100 points C# Solutions
using System; class Solution { static bool IsPandigital(int n, int k) { int i = 1; string numbers = ""; while (true) { numbers += (n * i).ToString(); if (numbers.Length >= k) { break; } i++; } if (numbers.Length == k && IsSubset(numbers, k)) { return true; } return false; } static bool IsSubset(string numbers, int k) { for (int a = 1; a <= k; a++) { if (!numbers.Contains(a.ToString())) { return false; } } return true; } static void Main(string[] args) { string[] input = Console.ReadLine().Split(); int n = int.Parse(input[0]); int k = int.Parse(input[1]); for (int i = 2; i < n; i++) { if (IsPandigital(i, k)) { Console.WriteLine(i); } } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #38: Pandigital multiples
You are viewing a single comment's thread. Return to all comments →
Here is my 100 points C# Solutions