結果

問題 No.987 N×Mマス計算(基本)
ユーザー watarimaycry2watarimaycry2
提出日時 2020-03-30 12:24:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,564 bytes
コンパイル時間 2,158 ms
コンパイル使用メモリ 76,468 KB
実行使用メモリ 61,416 KB
最終ジャッジ日時 2023-09-02 12:35:41
合計ジャッジ時間 7,323 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
56,724 KB
testcase_01 AC 155 ms
54,692 KB
testcase_02 AC 204 ms
59,112 KB
testcase_03 AC 189 ms
57,144 KB
testcase_04 AC 197 ms
59,320 KB
testcase_05 AC 186 ms
59,120 KB
testcase_06 AC 190 ms
59,020 KB
testcase_07 AC 180 ms
56,812 KB
testcase_08 AC 167 ms
56,772 KB
testcase_09 AC 170 ms
56,760 KB
testcase_10 WA -
testcase_11 AC 196 ms
59,028 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 169 ms
56,360 KB
testcase_15 AC 191 ms
57,172 KB
testcase_16 AC 246 ms
59,632 KB
testcase_17 WA -
testcase_18 AC 238 ms
59,556 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
        static Scanner sc = new Scanner(System.in);
        static void myout(Object t){System.out.println(t);}//standard output
        static void myerr(Object t){System.err.println(t);}//standard error
        static String getStr(){return sc.next();}
        static int getInt(){return Integer.parseInt(getStr());}
        static long getLong(){return Long.parseLong(getStr());}
        static boolean hasNext(){return sc.hasNext();}
        static char[] mySplit(String str){return str.toCharArray();}
        public static void main(String[] args){
          int N = getInt();
          int M = getInt();
          String op = getStr();
          ArrayList<Integer> mlist = new ArrayList<Integer>();
          ArrayList<Integer> nlist = new ArrayList<Integer>();
          for(int i = 0; i < M; i++){
            mlist.add(getInt());
          }
          for(int i = 0; i < N; i++){
            nlist.add(getInt());
          }
          
          for(int i = 0; i < N; i++){
            String output = "";
            for(int j = 0; j < M; j++){
              long val;
              if(op.equals("+")){
                val = nlist.get(i) + mlist.get(j);
              }else{
                val = nlist.get(i) * mlist.get(j);
              }
              if(j == 0){
                output += val;
              }else{
                output += " " + val;
              }
            }
            myout(output);
          }
        }
        //Method addition frame start

        //Method addition frame end
}
0