結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-02-21 08:27:43 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 785 ms / 2,000 ms |
| コード長 | 675 bytes |
| コンパイル時間 | 2,124 ms |
| コンパイル使用メモリ | 74,524 KB |
| 実行使用メモリ | 67,416 KB |
| 最終ジャッジ日時 | 2024-07-06 07:28:40 |
| 合計ジャッジ時間 | 11,675 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
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();
char op = sc.next().charAt(0);
long sumB = 0;
for (int i = 0; i < m; i++) {
sumB += sc.nextInt();
}
sumB %= k;
long sumA = 0;
for (int i = 0; i < n; i++) {
sumA += sc.nextInt();
}
sumA %= k;
if (op == '+') {
System.out.println((sumA * m + sumB * n) % k);
} else {
System.out.println(sumA * sumB % k);
}
}
}
htensai