|
|
back to boardfailed on test 2 , pls help! (C#) here's my code.Please give me some advise or test data! int n = int.Parse(Console.ReadLine()); int nCopy = n; int sum = 0; string[] array = new string[2]; short digitSum = 0; while(n-- != 0) { digitSum = 0; array = Console.ReadLine().Split(' '); foreach(var i in array) { digitSum += short.Parse(i); } sum += digitSum * (int)Math.Pow(10, n); } Console.WriteLine(sum.ToString().Length > nCopy ? sum.ToString().Substring(1):sum.ToString().PadLeft(nCopy,'0')); Re: failed on test 2 , pls help! (C#) From task description: > (1 ≤ N ≤ 1 000 000) Why do you think you are able to put result into 32-bit (10 digits max) int variable? |
|
|