結果

問題 No.2088 数当てゲーム
ユーザー shojin_proshojin_pro
提出日時 2022-09-30 21:48:48
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 469 bytes
コンパイル時間 1,982 ms
コンパイル使用メモリ 72,408 KB
実行使用メモリ 56,572 KB
最終ジャッジ日時 2023-08-24 15:18:22
合計ジャッジ時間 6,428 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 119 ms
56,572 KB
testcase_02 AC 120 ms
55,636 KB
testcase_03 AC 119 ms
56,228 KB
testcase_04 AC 121 ms
55,928 KB
testcase_05 AC 119 ms
55,824 KB
testcase_06 AC 120 ms
55,864 KB
testcase_07 WA -
testcase_08 AC 122 ms
55,968 KB
testcase_09 AC 120 ms
56,060 KB
testcase_10 AC 120 ms
55,388 KB
testcase_11 AC 121 ms
55,772 KB
testcase_12 AC 121 ms
56,244 KB
testcase_13 RE -
testcase_14 AC 120 ms
55,876 KB
testcase_15 WA -
testcase_16 AC 125 ms
55,544 KB
testcase_17 AC 119 ms
55,684 KB
testcase_18 AC 118 ms
56,144 KB
testcase_19 AC 118 ms
55,912 KB
testcase_20 AC 119 ms
55,920 KB
権限があれば一括ダウンロードができます

ソースコード

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(Math.abs(B) % (Math.abs(A)-1) == 0){
            if(A < 0){
                A = -A;
                B = -B;
            }
            System.out.println(-B/(A-1));
        }
    }
}
0