結果

問題 No.2194 兄弟の掛け引き
ユーザー tk55513tk55513
提出日時 2023-02-17 19:10:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 1,000 ms
コード長 613 bytes
コンパイル時間 2,304 ms
コンパイル使用メモリ 71,312 KB
実行使用メモリ 57,428 KB
最終ジャッジ日時 2023-09-26 16:54:08
合計ジャッジ時間 5,548 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,524 KB
testcase_01 AC 122 ms
55,728 KB
testcase_02 AC 122 ms
55,780 KB
testcase_03 AC 122 ms
57,428 KB
testcase_04 AC 122 ms
56,028 KB
testcase_05 AC 125 ms
55,752 KB
testcase_06 AC 123 ms
55,796 KB
testcase_07 AC 122 ms
55,752 KB
testcase_08 AC 122 ms
55,948 KB
testcase_09 AC 122 ms
55,956 KB
testcase_10 AC 124 ms
55,688 KB
testcase_11 AC 122 ms
55,980 KB
testcase_12 AC 122 ms
55,644 KB
testcase_13 AC 124 ms
56,092 KB
testcase_14 AC 125 ms
56,024 KB
testcase_15 AC 122 ms
56,116 KB
testcase_16 AC 123 ms
55,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String... args){
        Scanner sc=new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int b0=c;
        int b1=c+b;
        boolean isAns=false;
        if(b0%a==0&&c-b<=0){
            System.out.println(b0/a);
            isAns|=true;
        }
        if(b1%a==0){
            System.out.println(b1/a);
            isAns|=true;
        }
        if(!isAns){
            System.out.println(-1);
        }
    }
}
0