結果
| 問題 | 
                            No.933 おまわりさんこいつです
                             | 
                    
| コンテスト | |
| ユーザー | 
                             TS_KAs
                         | 
                    
| 提出日時 | 2019-11-29 22:41:10 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 417 bytes | 
| コンパイル時間 | 2,285 ms | 
| コンパイル使用メモリ | 192,080 KB | 
| 最終ジャッジ日時 | 2025-01-08 06:07:34 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 9 WA * 16 | 
ソースコード
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, P;
  ll K = 1;
  cin >> N;
  REP(i, N){
    cin >> P;
    K *= P;
  }
  while(K > 9){
    int s = to_string(K).size();
    ll ans = 0;
    REP(i, s){
      ans += K % 10;
      K /= 10;
    }
    K = ans;
  }
  cout << K << endl;
}
            
            
            
        
            
TS_KAs