Skip to content
Archive

Kattis Challenge "A Different Problem"

“Write a program that computes the difference between non-negative integers.”

Kattis Challenge "A Different Problem"

Problem

My solution

import java.util.Scanner;

public class Kattis {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {

            long X = sc.nextLong();
            long Y = sc.nextLong();

            if (X > Y) {
                System.out.println(Math.abs(X - Y));

            } else {
                System.out.println(Math.abs(X - Y));

            }
        }
    }
}

Related Reading

Related entries

Ranked from shared tags, categories, and keywords, with recent section entries used as a fallback.

Relationship Map

Connected Memory

This relationship map centers on the current entry and highlights connected categories and tags.

Categories 0
Tags 0
Entries 0