题解 | #A+B(1)#
A+B(1)
https://ac.nowcoder.com/acm/contest/5657/A
既然没有C#版本的,害,我来贡献一下吧。
using System; using System.Linq; public class Program { public static void Main(string[] args) { var readLine = Console.ReadLine(); var number = readLine.Split(' ').ToList(); int sum = 0; foreach (var item in number) { int num = 0; if (int.TryParse(item,out num) && num > 0) sum += num; } Console.Write(sum); } }