結果

問題 No.933 おまわりさんこいつです
ユーザー 0w1
提出日時 2019-12-01 16:35:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 2,034 ms
コンパイル使用メモリ 194,024 KB
最終ジャッジ日時 2025-01-08 06:37:43
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  vector<int64_t> P(N);
  for (int i = 0; i < N; ++i) {
    cin >> P[i];
  }

  bool zero = false;
  int ans = 1;
  for (int64_t p : P) {
    zero |= p == 0;
    ans = ans * (p % 9) % 9;
  }

  if (zero) cout << 0 << endl;
  else if (ans == 0) cout << 9 << endl;
  else cout << ans << endl;

  return 0;
}
0