Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace FromLeftToTheRight
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- string input = Console.ReadLine();
- if (input.Contains(" "))
- {
- int index = input.IndexOf(" ");
- Int64 firstSum = 0;
- Int64 secondSum = 0;
- Int64 tempForFirstNum = 0;
- Int64 tempForSecondNum = 0;
- string firstLoweredString = input.Remove(index);
- Int64 firstLoweredStringIntoNum = Int64.Parse(firstLoweredString);
- tempForFirstNum = Math.Abs(firstLoweredStringIntoNum);
- string secondLoweredString = input.Remove(0, (firstLoweredString.Length + 1));
- Int64 secondLoweredStringIntoNum = Int64.Parse(secondLoweredString);
- tempForSecondNum = Math.Abs(secondLoweredStringIntoNum);
- if (firstLoweredStringIntoNum > secondLoweredStringIntoNum)
- {
- do
- {
- Int64 lastDigit = tempForFirstNum % 10;
- firstSum += lastDigit;
- tempForFirstNum /= 10;
- } while (tempForFirstNum > 0);
- Console.WriteLine(firstSum);
- }
- else
- {
- do
- {
- Int64 lastDigit = tempForSecondNum % 10;
- secondSum += lastDigit;
- tempForSecondNum /= 10;
- } while (tempForSecondNum > 0);
- Console.WriteLine(secondSum);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement