1、c#中的[]除了数组的索引器外还有什么其他用法?
2、从0-9中取出两个三位数相加得到一个四位数(*** + *** = ****)的最佳算法。其中这两个三位数不能出现重复数据.
2、从0-9中取出两个三位数相加得到一个四位数(*** + *** = ****)的最佳算法。其中这两个三位数不能出现重复数据.
解决方案 »
- WinForm的一些问题
- 如何利用button控件将Listbox中的选中项上移下移
- 生成的静态页面如何做搜索功能
- ChechListBox
- c#winform窗體置於最前面
- 如何用C#编写的方法可以让其它开发工具使用如PB等(急急急!!!!!!!!!!!!!)
- 如何在 .NET Compact Framework 中实现“选择文件夹”标准对话框
- Win窗体的显示问题
- 在线等待:请问在ASP.NET中客户端控件,怎么在 C# 代码事件中读出它的值。
- C中的 char* 在C#中用什么来替代,不要说用 char* 指针
- C++如何调用C#写的dll?是否需要用到com技术?
- RichTextbox 的问题,,在线等答案!
public static extern void HelloWorld();
[DllImport("avifil32.dll")]
private static extern void AVIFileInit();小的不才,查了一下还是不明白楼上的意思。
//当然不是最优解private void Calc()
{
int[] Numbers = new int[1000];
int count = 0;
for (int i = 0; i < 1000; i++)
{
int a = i % 10;
int b = (i / 10) % 10;
int c = i / 100;
if (a == b || a == c || b == c) continue;
Numbers[count] = i;
count++;
}
int[,] Expression = new int[3, (1000 * 1000) / 2]; // [0]+[1]=[2]
int index = 0;
for (int i = 0; i < count; i++)
for (int j = i + 1; j < count; j++)
{
if (i == j) continue;
if (Numbers[i] + Numbers[j] < 1000 ||
Numbers[i] + Numbers[j] >= 10000) continue;
int a = Numbers[i] % 10;
int b = (Numbers[i] / 10) % 10;
int c = Numbers[i] / 100;
int d = Numbers[j] % 10;
int e = (Numbers[j] / 10) % 10;
int f = Numbers[j] / 100;
if (a == b || a == c || a == d || a == e || a == f || a == d ||
b == c || b == d || b == e || b == f || b == d || c == d ||
c == e || c == f || c == d || d == e || d == f || e == f ||
e == d || f == d)
continue;
Expression[0, index] = Numbers[i];
Expression[1, index] = Numbers[j];
Expression[2, index] = Numbers[i] + Numbers[j];
if (index < 1000)
Console.WriteLine("{0}+{1}={2}", Expression[0, index],
Expression[1, index], Expression[2, index]);
index++;
}
}
题目就是这样,因为是招oracle开发的,所以编程这方面考得不难。