結果

問題 No.988 N×Mマス計算(総和)
ユーザー Mishan5055Mishan5055
提出日時 2020-02-25 16:35:22
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 842 bytes
コンパイル時間 2,131 ms
コンパイル使用メモリ 71,520 KB
実行使用メモリ 56,020 KB
最終ジャッジ日時 2023-09-20 12:11:09
合計ジャッジ時間 8,717 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,468 KB
testcase_01 AC 125 ms
55,456 KB
testcase_02 AC 141 ms
55,600 KB
testcase_03 AC 136 ms
55,776 KB
testcase_04 AC 133 ms
55,828 KB
testcase_05 AC 142 ms
55,792 KB
testcase_06 AC 142 ms
56,020 KB
testcase_07 AC 143 ms
55,960 KB
testcase_08 AC 134 ms
55,828 KB
testcase_09 AC 139 ms
55,512 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
    }
}
0