数据结构唯一的数字组合. [英] Data Structue Unique Combination of digits.

查看:86
本文介绍了数据结构唯一的数字组合.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Folks,

您能帮我找到1-99位数字的唯一数字组合吗,例如

{1,2,3,4}

但是结合使用C#语言应该是唯一的.

谁能给我任何提示.我知道如何找到组合,但问题是如何仅找到唯一的组合.

谢谢

成员

Hello Folks,

Can you help me how to find out unique combination of digits for 1-99 digits eg.

{1, 2, 3, 4}

But the combination should be unique using C# language.

Can any body give me any hint. I know how to find combinations, but the problem is how to find unique combination only.

Thanks

Member

推荐答案

for(int a = 1; a < 97; a++)
  for(int b = a + 1; b < 98; b++)
    for(int c = b + 1; c < 99; c++)
      for(int d = c + 1; d < 100; d++)
        Console.WriteLine( a.ToString() + " " +
                           b.ToString() + " " +
                           c.ToString() + " " +
                           d.ToString());


这篇关于数据结构唯一的数字组合.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆