結果
問題 | No.988 N×Mマス計算(総和) |
ユーザー | 37zigen |
提出日時 | 2020-02-14 21:44:39 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 724 bytes |
コンパイル時間 | 1,913 ms |
コンパイル使用メモリ | 73,916 KB |
実行使用メモリ | 66,496 KB |
最終ジャッジ日時 | 2023-09-20 11:40:17 |
合計ジャッジ時間 | 11,009 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
56,164 KB |
testcase_01 | AC | 121 ms
55,524 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 130 ms
55,616 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 140 ms
55,952 KB |
testcase_08 | AC | 133 ms
56,040 KB |
testcase_09 | AC | 133 ms
55,884 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 504 ms
60,688 KB |
testcase_14 | WA | - |
testcase_15 | AC | 502 ms
60,828 KB |
testcase_16 | AC | 614 ms
62,644 KB |
testcase_17 | AC | 672 ms
64,764 KB |
testcase_18 | AC | 536 ms
60,304 KB |
testcase_19 | AC | 692 ms
63,104 KB |
testcase_20 | WA | - |
ソースコード
import java.util.Arrays; import java.util.Scanner; class Main { public static void main(String[] args) throws Exception { new Main().run(); } void run() { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); int M=sc.nextInt(); long K=sc.nextLong(); char op=sc.next().toCharArray()[0]; long[] A=new long[N]; long[] B=new long[M]; for(int i=0;i<M;++i)B[i]=sc.nextLong(); for(int i=0;i<N;++i)A[i]=sc.nextLong(); long sa=0,sb=0; for(int i=0;i<N;++i)sa+=A[i]; for(int i=0;i<M;++i)sb+=B[i]; if(op=='+') { System.out.println((M*sa%K+N*sb%K)%K); }else { System.out.println(sa*sb%K); } } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }