编程解决了 using System; using System.Collections.Generic; using System.Text;namespace c14 { class cls1 { public void method() {
int []arr = new int[10]; int sum=0; for (int i = 0; i < 10; i++) { int n = 0; for (int shi = 1; shi <= 1000; shi++) { string er = Convert.ToString(shi, 2).PadLeft(10, '0'); string strRight = er.Substring(er.Length - i - 1, 1); if (strRight == "1") { n++; sum++; } } Console.WriteLine("第右{0}位为'1'的总和为{1}",i,n); } Console.WriteLine("所有位数为1总和为{0}", sum); Console.ReadLine(); } } class Program { static void Main(string[] args) { cls1 cls = new cls1(); cls.method(); } } }
而另外一些企业,比如Google的问题,更加务实。
等待楼主给一个合理的答复,到底是不是CSDN派来的探子
想在问空余时间在网上赚钱的朋友请加群(7823221),此项目不收取任何费用,简单说就是推广行动(加群后有配套视频教材,和我
推荐的网址,可以直接操作),
操作十分简单一看就会, 只要朋友们有台电脑,有点空余时间,就可以赚钱,只是动动手就行,朋友们何乐而不为呢!
视频教材网址: http://www.tudou.com/programs/view/RsQ5rxHluMo/ 免费登陆后注册网址:http://www.fwbao.com/?r=m109960 (注册一个/2元)
免费登陆后注册网址:http://www.24bm.net/cf.aspx?33&xw009057 (注册一个/2元)
免费登陆后注册网址:http://www.jooplay.com/?378106 (注册一个/2元)
using System;
using System.Collections.Generic;
using System.Text;namespace c14
{
class cls1
{
public void method()
{
int []arr = new int[10];
int sum=0;
for (int i = 0; i < 10; i++)
{ int n = 0;
for (int shi = 1; shi <= 1000; shi++)
{ string er = Convert.ToString(shi, 2).PadLeft(10, '0');
string strRight = er.Substring(er.Length - i - 1, 1); if (strRight == "1")
{
n++;
sum++;
} }
Console.WriteLine("第右{0}位为'1'的总和为{1}",i,n); }
Console.WriteLine("所有位数为1总和为{0}", sum);
Console.ReadLine();
}
}
class Program
{
static void Main(string[] args)
{
cls1 cls = new cls1();
cls.method();
}
}
}