用C#求A+B A,B在同一行输入,之间用空格隔开

来源:互联网 发布:python 正则 匹配多个 编辑:程序博客网 时间:2024/06/05 22:35
2个整数A B,中间用空格分割。(0 <= A, B <= 10^9)   
输出A + B的计算结果。
-------------------------------------------------------------------------
using System;using System.IO;using System.Numerics;public class Sum{    public static void Main()    {        StreamReader sr = new StreamReader(Console.OpenStandardInput());        StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());        string[] s = sr.ReadLine().Split(' ');        sw.WriteLine(BigInteger.Parse(s[0]) + BigInteger.Parse(s[1]));        sr.Close();        sw.Close();    }}
0 0
原创粉丝点击