結果

問題 No.754 畳み込みの和
ユーザー kpinkcatkpinkcat
提出日時 2023-08-21 20:48:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 569 bytes
コンパイル時間 2,745 ms
コンパイル使用メモリ 103,316 KB
実行使用メモリ 13,436 KB
最終ジャッジ日時 2023-08-21 20:48:41
合計ジャッジ時間 13,806 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/iostream:39,
         次から読み込み:  main.cpp:1:
メンバ関数 ‘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:27:13:
/usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: 関数 ‘int main()’ 内:
main.cpp:14:23: 備考: ‘ans’ はここで定義されています
   14 |     long long n, mod, ans;
      |                       ^~~

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
using namespace std;


int main()
{
    long long n, mod, ans;
    cin >> n;
    mod = 1e9+7;
    vector<long long> a(n+1), b(n+1);
    
    for (long long i = 0; i < n+1; i++) cin >> a[i];
    for (long long i = 0; i < n+1; i++) cin >> b[i];
    for (long long i = 0; i < n+1; i++){
        for (int j = 0; j <= i; j++){
            ans += (a[j] * b[i-j])%mod;
            ans %= mod;
        }
    }
    cout << ans << endl;
}
0