using System; using System.Text.RegularExpressions; namespace _1016 { class Program { static void Main(string[] args) { string strIN = Console.ReadLine(); var strArr = strIN.Split(' '); string str1 = strArr[0]; string str2 = strArr[1]; string str3 = strArr[2]; string str4 = strArr[3]; string No1=string.Empty; foreach (Match match in Regex.Matches(str1,str2)) { No1 += match.Value; } int intNo1; if (String.IsNullOrEmpty(No1)) { intNo1 = 0; } else { intNo1 = int.Parse(No1); } string No2 = string.Empty; foreach (Match match in Regex.Matches(str3,str4)) { No2 += match.Value; } int intNo2; if (string.IsNullOrEmpty(No2)) { intNo2 = 0; } else { intNo2 = int.Parse(No2); } Console.WriteLine(intNo1+intNo2); } } } 此题太简单,思路见代码。 1015太坑,使用C#中的datatable,引入了system.data,结果PTA不能识别,需要想其他办法来解决。 |
|