結果
問題 | No.987 N×Mマス計算(基本) |
ユーザー |
![]() |
提出日時 | 2020-05-24 20:10:18 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 313 ms / 2,000 ms |
コード長 | 1,100 bytes |
コンパイル時間 | 2,493 ms |
コンパイル使用メモリ | 76,984 KB |
実行使用メモリ | 44,624 KB |
最終ジャッジ日時 | 2024-10-12 04:29:02 |
合計ジャッジ時間 | 7,036 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { // Your code here! Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); String op = sc.next(); long B[] = new long[M]; for(int i=0;i<M;i++) { B[i] = sc.nextInt(); } for(int j=0;j<N;j++) { long C = sc.nextLong(); for(int k=0;k<M;k++) { if(op.equals("+")) { if(k<M-1) { System.out.print(B[k] + C +" "); }else{ System.out.print(B[k] + C); } } else{ if(k<M-1) { System.out.print(B[k] * C +" "); }else{ System.out.print(B[k] * C); } } } System.out.println(""); } } }