static void Main(string[] args) { Permutate("1234", "", 1); } static void Permutate(string str, string result,int length) { if (str.Length == length) { Console.WriteLine(result); } for (int i = 0; i < str.Length; i++) { Permutate(str.Remove(i, 1), result + str[i],length); } }
class Program { static void Main() { for (int i = 1; i <= 4; i++) { for (int j = 1; j <= 4; j++) { for (int k = 1; k <= 4; k++) { if (!(i == j || j == k || k == i)) { System.Console.WriteLine("{0}{1}{2}", i, j, k); } } } } } }
{
static void Main()
{
System.Console.WriteLine(@"123
124
132
134
142
143
213
214
231
234
241
243
312
314
321
324
341
342
412
413
421
423
431
432");
}
}
static void Main(string[] args)
{
Permutate("1234", "", 1);
}
static void Permutate(string str, string result,int length)
{
if (str.Length == length)
{
Console.WriteLine(result);
}
for (int i = 0; i < str.Length; i++)
{
Permutate(str.Remove(i, 1), result + str[i],length);
}
}
{
static void Main()
{
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= 4; j++)
{
for (int k = 1; k <= 4; k++)
{
if (!(i == j || j == k || k == i))
{
System.Console.WriteLine("{0}{1}{2}", i, j, k);
}
}
}
}
}
}