More Exercise: Data Types and Variables - From Left to the Right
Здравейте,
може ли някой да каже защо в Judge това решение ми дава 25/100 (пробвах дори с BigInteger, но няма разлика):
using System;
using System.Numerics;
namespace FromLeftToTheRight
{
class Program
{
static void Main(string[] args)
{
int numOfLines = int.Parse(Console.ReadLine());
for (int i = numOfLines - 1; i >= 0; i--)
{
string inputStr = Console.ReadLine();
int indexOfSpace = 0;
string firstNum = "";
string secondNum = "";
BigInteger sumOfDigits = 0;
for (int j = 0; j <= inputStr.Length - 1; j++)
{
if ((int)inputStr[j] == 32)
{
indexOfSpace = j;
break;
}
}
for (int k = 0; k <= indexOfSpace - 1; k++)
{
firstNum += (char)inputStr[k];
}
for (int l = indexOfSpace + 1; l < inputStr.Length; l++)
{
secondNum += (char)inputStr[l];
}
BigInteger firstNumber = BigInteger.Parse(firstNum);
BigInteger secondNumber = BigInteger.Parse(secondNum);
if (firstNumber > secondNumber)
{
while (firstNumber > 0)
{
BigInteger resultNum = 0;
BigInteger.DivRem(firstNumber, 10, out resultNum);
sumOfDigits += resultNum;
firstNumber /= 10;
}
}
else
{
while (secondNumber > 0)
{
BigInteger resultNum = 0;
BigInteger.DivRem(secondNumber, 10, out resultNum);
sumOfDigits += resultNum;
secondNumber /= 10;
}
}
Console.WriteLine(sumOfDigits);
}
}
}
}