結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-08-24 21:04:41 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 947 bytes |
| コンパイル時間 | 2,213 ms |
| コンパイル使用メモリ | 74,800 KB |
| 実行使用メモリ | 54,456 KB |
| 最終ジャッジ日時 | 2024-11-06 10:40:49 |
| 合計ジャッジ時間 | 8,716 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 TLE * 1 -- * 10 |
ソースコード
import java.util.*;
public 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();
boolean isPlus = (sc.next().charAt(0) == '+');
long[] colums = new long[m];
for (int i = 0; i < m; i++) {
colums[i] = sc.nextInt();
}
int[] rows = new int[n];
for (int i = 0; i < n; i++) {
rows[i] = sc.nextInt();
}
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
long value;
if (isPlus) {
value = colums[j] + rows[i];
} else {
value = colums[j] * rows[i];
}
ans += (int)(value % k);
ans %= k;
}
}
System.out.println(ans);
}
}
tenten