結果
| 問題 | No.754 畳み込みの和 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-12-02 00:52:12 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 29 ms / 5,000 ms | 
| コード長 | 459 bytes | 
| コンパイル時間 | 378 ms | 
| コンパイル使用メモリ | 23,168 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-27 04:34:00 | 
| 合計ジャッジ時間 | 808 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |     scanf("%lld", &a[i]);
      |     ~~~~~^~~~~~~~~~~~~~~
main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     scanf("%lld", &b[i]);
      |     ~~~~~^~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#define M 1000000007
long long a[100001];
long long b[100001];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 0; i <= n; i++) {
    scanf("%lld", &b[i]);
    if (i > 0) {
      b[i] += b[i - 1];
      b[i] %= M;
    }
  }
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    ans += a[i] * b[n - i];
    ans %= M;
  }
  printf("%lld\n", ans);
  return 0;
}
            
            
            
        