Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Proba {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int count = Integer.parseInt(sc.nextLine());
- for (int i = 1; i <= count; i++) {
- String input = sc.nextLine();
- int index = input.indexOf(" ");
- long first = Long.parseLong(input.substring(0, index));
- long second = Long.parseLong(input.substring(index + 1));
- long sum = 0;
- long greater = 0;
- greater = Math.max(first, second);
- while (greater != 0) {
- sum += greater % 10;
- greater /= 10;
- }
- System.out.println(Math.abs(sum));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement