結果

問題 No.373 かけ算と割った余り
ユーザー atkrymatkrym
提出日時 2016-11-07 21:48:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 2,231 ms
コンパイル使用メモリ 71,832 KB
実行使用メモリ 55,908 KB
最終ジャッジ日時 2023-08-16 14:43:54
合計ジャッジ時間 3,336 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,696 KB
testcase_01 AC 115 ms
55,908 KB
testcase_02 AC 118 ms
53,828 KB
testcase_03 AC 116 ms
55,684 KB
testcase_04 AC 117 ms
55,396 KB
testcase_05 AC 117 ms
55,840 KB
testcase_06 AC 116 ms
55,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        BigInteger a = new BigInteger(sc.next());
        BigInteger b = new BigInteger(sc.next());
        BigInteger c = new BigInteger(sc.next());
        BigInteger d = new BigInteger(sc.next());
        BigInteger ret = mod(mod(mod(a,d).multiply(b),d).multiply(c),d);
        System.out.println(ret);
    }
    
    public static BigInteger mod(BigInteger a,BigInteger b) {
        return a.mod(b);
    }
}
0