結果

問題 No.2088 数当てゲーム
ユーザー shojin_proshojin_pro
提出日時 2022-09-30 21:48:04
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 2,351 ms
コンパイル使用メモリ 76,400 KB
実行使用メモリ 41,388 KB
最終ジャッジ日時 2024-12-22 23:16:05
合計ジャッジ時間 6,334 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        if(A == 0){
            System.out.println(B);   
        }else if(B == 0){
            System.out.println(0);   
        }else if(Math.abs(B) % (Math.abs(A)-1) == 0){
            if(A < 0){
                A = -A;
                B = -B;
            }
            System.out.println(-B/(A-1));
        }
    }
}
0