結果

問題 No.643 Two Operations No.2
ユーザー takeya_okino
提出日時 2019-09-15 12:07:37
言語 Java
(openjdk 23)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 2,086 ms
コンパイル使用メモリ 74,140 KB
実行使用メモリ 54,464 KB
最終ジャッジ日時 2024-07-06 22:41:33
合計ジャッジ時間 4,685 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int ans = -1;
    if(x == y) {
      ans = 0;
    } else if(y == 0) {
      ans = 1;
    } else if(x == 0) {
      ans = 2;
    } else if((x + y) == 0) {
      ans = 3;
    }
    System.out.println(ans);
  }
}
0