結果

問題 No.933 おまわりさんこいつです
ユーザー bonKotsu
提出日時 2021-11-30 17:13:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 508 bytes
コンパイル時間 3,766 ms
コンパイル使用メモリ 251,056 KB
最終ジャッジ日時 2025-01-26 02:31:38
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define LP pair<ll, ll>


int main() {
  int n;
  cin >> n;
  ll ans = 1;
  ll flag = false;
  rep(i,n) {
    ll p;
    cin >> p;
    if (p%9) ans *= p%9;
    else if (p == 0) {
      ans *= 0;
      flag = true;
    }
    else ans *= 9;
    ans %= 9;
  }
  if (!flag && ans == 0) ans = 9;
  cout << ans << endl;


  
}
0