http://topic.csdn.net/u/20080705/16/a9070b29-c658-47bc-8807-95b1d700a69f.html
解决方案 »
- 【升星+散分】SQL SERVER选择字段时,前面加表名与不加表名的效率问题
- 懂使用SharpZipLib制作压缩文件的高手帮帮我
- 使用Windows Service 来Host Remoting,IPC出错,但可以调用一次
- Enterprise Library 在中型mis系统是否使用了,谢谢了
- 怎么样先判断一个string是不是英文构成的字符串?代码,谢谢。
- 我该如何获得当前程序的所有 的线程,并进行关闭?引用 Knight94(愚翁)
- 水晶报表如何快速上手?
- fastreport打印条码
- 求教类似数学建模,带未知数的四则运算
- listview中关于checkitems的问题!
- vs2005如何添加Excel Workbook等模板
- 如何将string[] a转换为 string b
{
//for (int z = 1; z <1000; z++)
// {
// if(z%2==0 && z%3!=0)
// {
// if (cacut(z) > 9)
// {
// Console.WriteLine("这个数字就不行:" + z);
// }
// else
// {
// Console.WriteLine("这个虽然成立:" + z+"但不知道一个更大的数行不行?");
// }
// }
// }
int z=89765556;
if (cacut(89765556) > 9)
{
Console.WriteLine("这个数字就不行:" +z);
}
Console.ReadLine();
}
private static int cacut(int n)
{
int step = 0;
int result=n;
while (step < 10 && result>1)
{
int newshu = sum(result);
if (result % 2 == 0)
{
result = newshu * newshu;
}
else
{
result = newshu * newshu * newshu;
}
step++;
} return step;
} private static int sum(int xy)
{
int sum = 0;
while (xy >= 10)
{
sum += xy % 10;
xy = xy / 10;
}
return sum + xy;
} }
static void Main(string[] args)
{
//for (int z = 1; z <1000; z++)
// {
// if(z%2==0 && z%3!=0)
// {
// if (cacut(z) > 9)
// {
// Console.WriteLine("这个数字就不行:" + z);
// }
// else
// {
// Console.WriteLine("这个虽然成立:" + z+"但不知道一个更大的数行不行?");
// }
// }
// }
int z=89765556;
if (cacut(89765556) > 9)
{
Console.WriteLine("这个数字就不行:" +z);
}
Console.ReadLine();
}
private static int cacut(int n)
{
int step = 0;
int result=n;
while (step < 10 && result>1)
{
int newshu = sum(result);
if (result % 2 == 0)
{
result = newshu * newshu;
}
else
{
result = newshu * newshu * newshu;
}
step++;
} return step;
} private static int sum(int xy)
{
int sum = 0;
while (xy >= 10)
{
sum += xy % 10;
xy = xy / 10;
}
return sum + xy;
} }