結果

問題 No.1047 Zero (Novice)
ユーザー silviasetitechsilviasetitech
提出日時 2020-05-10 09:11:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 1,067 bytes
コンパイル時間 2,425 ms
コンパイル使用メモリ 75,568 KB
実行使用メモリ 41,756 KB
最終ジャッジ日時 2024-07-07 04:32:57
合計ジャッジ時間 5,953 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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