Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- using System.Numerics;
- using System.Linq;
- namespace FromLeftToRight
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- long realSum = 0L;
- for (int i = 0; i < n; i++)
- {
- long[] numbers = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
- long a = numbers[0];
- long b = numbers[1];
- if (a>b)
- {
- for (int j = 1; j <= Math.Abs(numbers[0]); j++)
- {
- long numT = Math.Abs(a);
- long sumT = 0L;
- while (numT != 0)
- {
- sumT += Math.Abs(numT % 10);
- numT = numT / 10;
- }
- realSum = sumT;
- }
- }
- else
- {
- for (int j = 1; j <= Math.Abs(numbers[1]); j++)
- {
- long numG = Math.Abs(b);
- long sumG = 0L;
- while (numG != 0)
- {
- sumG += Math.Abs(numG % 10);
- numG = numG / 10;
- }
- realSum = sumG;
- }
- }
- Console.WriteLine(Math.Abs(realSum));
- realSum = 0L;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement