2009-04-01 11:04
col1 col2
53 0
48 1
54 2
48 3
42 4
36 5
35 6
35 7
29 8
29 9
30 10
23 11
23 12
23 13
23 14
23 15
18 16
20 17
18 18
18 19
18 20
17 21
18 22
19 23
14 24
10 25
12 26
13 27
14 28
13 29
13 30
15 31
16 32
8 33
15 34
15 35
8 36
8 37
8 38
8 39
9 40
col1 col2
53 0
48 1
54 2
48 3
42 4
36 5
35 6
35 7
29 8
29 9
30 10
23 11
23 12
23 13
23 14
23 15
18 16
20 17
18 18
18 19
18 20
17 21
18 22
19 23
14 24
10 25
12 26
13 27
14 28
13 29
13 30
15 31
16 32
8 33
15 34
15 35
8 36
8 37
8 38
8 39
9 40
解决方案 »
- gridview自动更新+语音提示
- 请教chrome浏览器自带的图片拖拽和我自己编写的冲突怎么办
- B 端调用 S端的程序???
- 在线等,关于一个webservice的问题
- 无法在VS2010中创建SQL Server
- 2005如何设置session时间?
- 請問能否在刷新一個頁面的時候不刷新該頁面中的一個iframe裡面的內容。?????
- ASP.NET编写MobileWebForm的时候,一点击Command(即按钮)就出现Malformed server response何解?
- 想大家请教一个小问题!!谢谢
- 有哪位知道在ASP.NET里怎么用调色板呀?有分
- DataTable排序问题
- 月份财务报告的数据表的写法,怎么写最好,没思路
foreach (int x in col1)
{
sum += x;
}
System.Console.WriteLine(sum);
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text.RegularExpressions;public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
计算(); }
void 计算()
{
string strInput = @"53 0
48 1
54 2
48 3
42 4
36 5
35 6
35 7
29 8
29 9
30 10
23 11
23 12
23 13
23 14
23 15
18 16
20 17
18 18
18 19
18 20
17 21
18 22
19 23
14 24
10 25
12 26
13 27
14 28
13 29
13 30
15 31
16 32
8 33
15 34
15 35
8 36
8 37
8 38
8 39
9 40 ";
int sum = 0;
Regex regex = new Regex(@"\r\n");
foreach (var item in regex.Split(strInput))
{
Regex _regex = new Regex(@"\s+");
int i = 0;
foreach (var _item in _regex.Split(item))
{
if (i % 2 != 0)
{
if (_item == "")
{
continue;
}
sum += Convert.ToInt32(_item);
}
i++;
} }
}}