咳..第二题发现个问题.出栈后,,stack的值是在减小的..当i跟stack.count值相等时,就会跳出循环,所以得不到想要的结果..
解决方案 »
- 在 ServiceModel 客户端配置部分中,找不到引用协定“Kiss.IService”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客
- c#实现用一个winform程序监控操纵一个windows服务
- 控制台按照指定格式输出
- 获取文件路径
- 毫无头绪问题,会的人帮引导下
- 我是asp.net菜鳥,今天要來一個asp.net的好几年经验的面試,大家出主意。。
- 关于进程,uac的问题
- 字符串分成的子字符串个数是不确定的,如何存储?怎样做?切求
- C#中怎么获取页面某个元素后面的字符串
- 用ADOX创建access后,为什么第一条记录无法插入?
- ===C#打包的问题===
- 处理字符串后保存到数组中的简单问题
int count = 0;
for (int one = 0; one < 101;one++ )
{
for (int two = 0; two < 51;two++ )
{
for (int five = 0; five < 21;five++ )
{
if (one*1+two*2+five*5==100)
{
Console.WriteLine("{0} one,{1} two,{2} five", one, two, five);
count++;
}
}
}
}
Console.WriteLine(count.ToString());
Console.ReadKey();
for (int five = 0; five < 21; five++)
{
for (int two = 0; two < 51; two++)
{
for (int one = 0; one < 101; one++)
{
if (one * 1 + two * 2 + five * 5 == 100)
{
Console.WriteLine("{0} five,{1} two,{2} one", five, two, one);
count++;
}
}
}
}
Console.WriteLine(count.ToString());
Console.ReadKey();
代码如下:string path = @"c:\MyTest.txt";
if (!File.Exists(path))
{
// Create a file to write to.
string[] createText = { "Hello", "And", "Welcome" };
File.WriteAllLines(path, createText);
} int count = 0;
for (int one = 0; one < 101;one++ )
{
for (int two = 0; two < 51;two++ )
{
for (int five = 0; five < 21;five++ )
{
if (one*1+two*2+five*5==100)
{
Console.Write("{0} one,{1} two,{2} five", one, two, five);
string appendText = one.ToString()+"one, "+two.ToString()+"two, "+five.ToString()+"five "+ Environment.NewLine;
File.AppendAllText(path, appendText);
count++;
}
}
}
}
Console.WriteLine(count.ToString());
File.AppendAllText(path, count.ToString());
Console.ReadKey();
int count = 0;
//先求5分的数量
for (int i = 0; i < 101; i = i + 5)
{
//之后求2分可以出现的次数
count += (i / 2 + 1);
}
Console.WriteLine(count.ToString());