結果

問題 No.2088 数当てゲーム
ユーザー shojin_proshojin_pro
提出日時 2022-09-30 21:47:39
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 583 bytes
コンパイル時間 2,264 ms
コンパイル使用メモリ 71,696 KB
実行使用メモリ 56,360 KB
最終ジャッジ日時 2023-08-24 15:16:46
合計ジャッジ時間 6,197 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,360 KB
testcase_01 AC 120 ms
56,080 KB
testcase_02 AC 119 ms
55,780 KB
testcase_03 AC 120 ms
56,032 KB
testcase_04 AC 120 ms
55,976 KB
testcase_05 AC 120 ms
55,328 KB
testcase_06 AC 120 ms
55,836 KB
testcase_07 WA -
testcase_08 AC 120 ms
56,044 KB
testcase_09 AC 123 ms
55,648 KB
testcase_10 AC 120 ms
56,292 KB
testcase_11 AC 121 ms
55,332 KB
testcase_12 AC 121 ms
56,112 KB
testcase_13 AC 119 ms
55,768 KB
testcase_14 AC 120 ms
55,832 KB
testcase_15 WA -
testcase_16 AC 122 ms
55,728 KB
testcase_17 AC 123 ms
56,352 KB
testcase_18 AC 120 ms
55,640 KB
testcase_19 AC 122 ms
56,352 KB
testcase_20 AC 120 ms
55,500 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));
        }else{
            System.out.println(0);
        }
    }
}
0