結果

問題 No.373 かけ算と割った余り
ユーザー mits58mits58
提出日時 2016-06-05 17:22:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 2,036 ms
コンパイル使用メモリ 73,924 KB
実行使用メモリ 41,296 KB
最終ジャッジ日時 2024-04-17 12:08:27
合計ジャッジ時間 3,532 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
41,132 KB
testcase_01 AC 120 ms
41,068 KB
testcase_02 AC 125 ms
41,080 KB
testcase_03 AC 122 ms
41,280 KB
testcase_04 AC 127 ms
41,220 KB
testcase_05 AC 119 ms
41,012 KB
testcase_06 AC 119 ms
41,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			long a=sc.nextLong();
			long b=sc.nextLong();
			long c=sc.nextLong();
			long d=sc.nextLong();
			a%=d; b%=d; c%=d;
			long ans=(a*b)%d;
			ans=(ans*c)%d;
			System.out.println(ans%d);
		}
	}
}
0