結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,688 KB
testcase_01 AC 128 ms
55,828 KB
testcase_02 AC 127 ms
55,736 KB
testcase_03 AC 128 ms
55,772 KB
testcase_04 AC 119 ms
55,612 KB
testcase_05 AC 118 ms
55,656 KB
testcase_06 AC 118 ms
55,836 KB
testcase_07 WA -
testcase_08 AC 121 ms
56,400 KB
testcase_09 AC 120 ms
55,940 KB
testcase_10 AC 119 ms
55,680 KB
testcase_11 AC 120 ms
55,536 KB
testcase_12 AC 118 ms
55,376 KB
testcase_13 AC 118 ms
55,684 KB
testcase_14 AC 120 ms
56,116 KB
testcase_15 WA -
testcase_16 AC 119 ms
55,708 KB
testcase_17 AC 119 ms
55,448 KB
testcase_18 AC 119 ms
56,088 KB
testcase_19 AC 119 ms
56,128 KB
testcase_20 AC 120 ms
55,716 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(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