可以使用C#语言的在线ACM题库

俄罗斯乌拉尔大学在线题库  是一个可以使用C#语言的在线ACM题库,有兴趣的朋友可以去试试。

Problem 1000. A+B Problem  是入门,就是简单地求整数 A 和 B 的和就行了,答案如下:

 1  using  System;
 2 
 3  //   http://acm.timus.ru/problem.aspx?space=1 &num=1000
 4  class  Acm1000
 5  {
 6     static   void  Main()
 7    {
 8       string [] ss  =  Console.ReadLine().Split();
 9      Console.WriteLine( long .Parse(ss[ 0 ])  +   long .Parse(ss[ 1 ]));
10    }
11  }
12 

Problem 1001. Reverse root  也很简单,就是给出一组整数,然后反序输出其平方根就行了,答案如下:

 1  using  System;
 2  using  System.Threading;
 3  using  System.Globalization;
 4  using  System.Text.RegularExpressions;
 5 
 6  //   http://acm.timus.ru/problem.aspx?space=1 &num=1001
 7  class  Acm1001
 8  {
 9     static   void  Main()
10    {
11      Thread.CurrentThread.CurrentCulture  =  CultureInfo.InvariantCulture;
12       string [] nums  =  Regex.Split(Console.In.ReadToEnd().Trim(),  @" \s+ " );
13       for  ( int  i  =  nums.Length  -   1 ; i  >=   0 ; i -- )
14        Console.WriteLine( " {0:F4} " , Math.Sqrt( ulong .Parse(nums[i])));
15    }
16  }
17 

注意该程序的第11行不可省略,不然就无法通过。目前还不知道是什么原因( 已经找到原因了,请参见2楼的评论 )。

Problem 1005. Stone pile  要求将若干石头分为两堆使其重量差最小,答案如下:

 1  using  System;
 2  using  System.IO;
 3  using  System.Text.RegularExpressions;
 4 
 5  //   http://acm.timus.ru/problem.aspx?space=1 &num=1005
 6  class  Acm1005
 7  {
 8     static   void  Main()
 9    {
10       new  Acm1005().Run(Console.In, Console.Out);
11    }
12 
13     void  Run(TextReader reader, TextWriter writer)
14    {
15      writer.WriteLine(GetResult(GetWeigths(reader)));
16    }
17 
18     int [] GetWeigths(TextReader reader)
19    {
20       string [] ss  =  Regex.Split(reader.ReadToEnd().Trim(),  @" \s+ " );
21       int [] weigths  =   new   int [ int .Parse(ss[ 0 ])];
22       for  ( int  i  =   0 ; i  <  weigths.Length; i ++ ) weigths[i]  =   int .Parse(ss[i  +   1 ]);
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值