結果

問題 No.933 おまわりさんこいつです
ユーザー minato
提出日時 2019-11-29 22:08:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 496 bytes
コンパイル時間 1,543 ms
コンパイル使用メモリ 168,236 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-20 23:20:57
合計ジャッジ時間 2,703 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
const double PI = acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
  int N; cin >> N;
  vector<ll> P(N);
  rep(i,N) cin >> P[i];
  
  ll ans = 1;
  rep(i,N) {
    ans *= P[i];
    while (ans >= 10) {
      ll p = ans;
      ans = 0;
      while (p != 0) {
        ans += p % 10;
        p /= 10;
      }
    }
  }

  cout << ans << endl;
}
0