結果

問題 No.373 かけ算と割った余り
コンテスト
ユーザー kitamoto0407
提出日時 2025-12-06 13:31:29
言語 Java
(openjdk 23)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 983 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,788 ms
コンパイル使用メモリ 79,856 KB
実行使用メモリ 45,208 KB
最終ジャッジ日時 2025-12-06 13:31:33
合計ジャッジ時間 4,219 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.io.*;
import java.util.*;
import java.util.stream.*;

class Process {
    private int A;
    private int B;
    private int C;
    private int D;

    Process(int A, int B, int C, int D) {
        this.A = A;
        this.B = B;
        this.C = C;
        this.D = D;
    }

    long getResult() {
        return (((((long)A * B) % D) * C) % D);
    }
}

public class Main {
    public static void main(String[] args) throws IOException {
        var bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        var printWriter    = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

        // 入力
        int[] input = Stream.of(bufferedReader.readLine().trim().split("[ ]+")).mapToInt(Integer::parseInt).toArray();

        // 処理および出力
        printWriter.println((new Process(input[0], input[1], input[2], input[3])).getResult());
        
        bufferedReader.close();
        printWriter.close();
    }
}
0