結果
| 問題 | No.988 N×Mマス計算(総和) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-25 16:35:22 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 842 bytes |
| 記録 | |
| コンパイル時間 | 1,777 ms |
| コンパイル使用メモリ | 82,276 KB |
| 実行使用メモリ | 47,088 KB |
| 最終ジャッジ日時 | 2026-03-27 18:58:20 |
| 合計ジャッジ時間 | 6,426 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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);
}
}