結果

問題 No.933 おまわりさんこいつです
ユーザー iqueue02
提出日時 2019-11-29 21:51:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 435 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 168,472 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-20 21:57:19
合計ジャッジ時間 2,670 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n;
  cin >> n;
  string K;
  ll x = 1;
  rep(i,n) {
    ll p;
    cin >> p;
    x *= p;
  }
  K = to_string(x);

  while (K.size() != 1) {
    ll d = 0;
    rep(i,K.size()) d += K[i] - '0';
    K = to_string(d);
  }
  cout << K << endl;
  return 0;
}
0