Submission #1358079


Source Code Expand

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            long x = Long.parseLong(strArr[0]);
            long y = Long.parseLong(strArr[1]);
            if (x >= 0) {
                if (y >= 0) {
                    System.out.println(y - x);
                } else {
                    long diff = (-1 * y) - x;
                    System.out.println(diff + 1);
                }
            } else {
                if (y >= 0) {
                    long diff = y - (-1 * x);
                    System.out.println(diff + 1);
                } else {
                    long diff = (-1 * y) - (-1 * x);
                    System.out.println(diff + 2);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
           }
    }
}

Submission Info

Submission Time
Task A - Simple Calculator
User unirita17
Language Java8 (OpenJDK 1.8.0)
Score 0
Code Size 1151 Byte
Status WA
Exec Time 74 ms
Memory 23124 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 8
WA × 6
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt
Case Name Status Exec Time Memory
0_00.txt AC 70 ms 21204 KB
0_01.txt AC 67 ms 19284 KB
0_02.txt AC 70 ms 19156 KB
1_00.txt AC 69 ms 18900 KB
1_01.txt AC 67 ms 18260 KB
1_02.txt AC 74 ms 19156 KB
1_03.txt WA 68 ms 18132 KB
1_04.txt WA 68 ms 19156 KB
1_05.txt WA 72 ms 23124 KB
1_06.txt AC 69 ms 18772 KB
1_07.txt WA 68 ms 22356 KB
1_08.txt AC 68 ms 20692 KB
1_09.txt WA 68 ms 21204 KB
1_10.txt WA 67 ms 21332 KB