結果

問題 No.987 N×Mマス計算(基本)
ユーザー rogi52
提出日時 2022-09-26 15:26:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 2,141 ms
コンパイル使用メモリ 195,580 KB
最終ジャッジ日時 2025-02-07 16:08:34
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /usr/include/c++/13/istream:41,
                 from /usr/include/c++/13/sstream:40,
                 from /usr/include/c++/13/complex:45,
                 from /usr/include/c++/13/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127,
                 from main.cpp:1:
In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’,
    inlined from ‘int main()’ at main.cpp:21:21:
/usr/include/c++/13/ostream:204:25: warning: ‘x’ may be used uninitialized [-Wmaybe-uninitialized]
  204 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function ‘int main()’:
main.cpp:18:16: note: ‘x’ was declared here
   18 |             ll x;
      |                ^

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int N,M; cin >> N >> M;
    char op; cin >> op;
    vector<ll> A(N), B(M);
    rep(i,M) cin >> B[i];
    rep(i,N) cin >> A[i];

    rep(i,N){
        rep(j,M) {
            ll x;
            if(op == '+') x = A[i] + B[j];
            if(op == '*') x = A[i] * B[j];
            cout << x << " ";
        } cout << endl;
    }
}
0