結果

問題 No.885 アマリクエリ
ユーザー risujiroh
提出日時 2019-09-13 22:45:33
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 462 bytes
コンパイル時間 541 ms
コンパイル使用メモリ 117,880 KB
実行使用メモリ 14,208 KB
最終ジャッジ日時 2024-11-30 14:56:10
合計ジャッジ時間 28,627 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("Ofast,unroll-loops")
#pragma GCC target ("avx")
#include <iostream>
using namespace std;

int n, a[100000], m, x;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  cin >> m;
  while (m--) {
    cin >> x;
    const int v = x;
    long long res = 0;
    for (int i = 0; i < n; ++i) {
      if (a[i] >= v) a[i] %= v;
      res += a[i];
    }
    cout << res << '\n';
  }
}
0