ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1409. Two Gangsters

Actual Solution is Wrong Answer
Posted by jamiurrahmanorin 13 Apr 2014 19:32
I think the actual solution may like this:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int harry, larry, max;

        while(sc.hasNext()){
            harry = sc.nextInt();
            larry = sc.nextInt();

            max = harry + larry;

            if(((max % 10) != 0)){

                if(((max % 10) <= ((max / 10)))){
                    max = (10 * ((max / 10)));
                }
                else{
                    max = (10 * ((max / 10) + 1));
                }
            }
            System.out.println((max - harry) +" "+ (max - larry));
        }
        sc.close();
    }

}