結果

問題 No.1047 Zero (Novice)
ユーザー silviasetitechsilviasetitech
提出日時 2020-05-10 09:11:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 1,067 bytes
コンパイル時間 1,767 ms
コンパイル使用メモリ 71,940 KB
実行使用メモリ 56,496 KB
最終ジャッジ日時 2023-09-21 10:27:22
合計ジャッジ時間 5,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
56,096 KB
testcase_01 AC 112 ms
56,212 KB
testcase_02 AC 115 ms
55,940 KB
testcase_03 AC 113 ms
55,924 KB
testcase_04 AC 115 ms
56,496 KB
testcase_05 AC 115 ms
55,696 KB
testcase_06 AC 116 ms
56,044 KB
testcase_07 AC 114 ms
55,380 KB
testcase_08 AC 112 ms
55,704 KB
testcase_09 AC 115 ms
55,900 KB
testcase_10 AC 115 ms
55,452 KB
testcase_11 AC 111 ms
55,424 KB
testcase_12 AC 109 ms
55,388 KB
testcase_13 AC 112 ms
54,200 KB
testcase_14 AC 111 ms
55,996 KB
testcase_15 AC 110 ms
56,072 KB
testcase_16 AC 113 ms
56,388 KB
testcase_17 AC 114 ms
55,704 KB
testcase_18 AC 112 ms
55,724 KB
testcase_19 AC 114 ms
55,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        No1047ZeroNovice solver = new No1047ZeroNovice();
        solver.solve(1, in, out);
        out.close();
    }

    static class No1047ZeroNovice {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            long a = in.nextLong();
            long b = in.nextLong();

            if (b == 0) {
                out.println(1);
                return;
            }

            // b != 0{
            if (a == -1) {
                out.println(2);
                return;
            }

            out.println(-1);
        }

    }
}

0