結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-25 16:35:22 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 842 bytes |
| コンパイル時間 | 2,380 ms |
| コンパイル使用メモリ | 74,548 KB |
| 実行使用メモリ | 54,540 KB |
| 最終ジャッジ日時 | 2024-07-06 07:30:43 |
| 合計ジャッジ時間 | 8,568 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 TLE * 1 -- * 10 |
ソースコード
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
int M=sc.nextInt();
int K=sc.nextInt();
String str=sc.next();
long[] B=new long[M];
long[] A=new long[N];
for(int i=0;i<M;i++){
B[i]=sc.nextLong();
}
for(int i=0;i<N;i++){
A[i]=sc.nextLong();
}
long ANS=0L;
for(int i=0;i<M;i++){
for(int j=0;j<N;j++){
if(str.equals("+")){
ANS+=A[j]+B[i];
ANS=ANS%K;
}else{
ANS+=A[j]*B[i];
ANS=ANS%K;
}
}
}
System.out.println(ANS);
}
}