SO_31175503asd

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		
	}

	public static int[] toBase(long bs, long value)
	{
		int[] result = new int[bs];
		for (long i = bs - 1; i >= 0; i--)
		{
			result[i] = (int)(value % bs);
			value = value / bs;
		}
		return result;
	}
	
	public static long Pow(long a, long b)
	{
		long result = 1;
		for (int i = 0; i < b; i++) result *= a;
		return result;
	}
	
	public static char[] pool = new char[] { 'a', 'b', 'c', '3', '5', '6' };
	
	public static void outputAll()
	{
		long n = pool.Length;
		for (long i = 0; i < Pow(n, n); i++)
		{
			int[] indices = toBase(n, i);
			for (int j = 0; j < n; j++)
				Console.Write("{0} ", pool[indices[j]]);
			Console.WriteLine();
		}
	}
}
;