結果

問題 No.933 おまわりさんこいつです
ユーザー kiefer_von_maus
提出日時 2019-12-07 20:27:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 545 bytes
コンパイル時間 2,025 ms
コンパイル使用メモリ 165,768 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 06:10:57
合計ジャッジ時間 3,143 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    long p[n];
    long long total = 1LL;
    for(int i = 0; i < n; i++) {
        cin >> p[i];
        total *= p[i];
    }
    auto f = [&] (ll c) {
    	ll digit = 0ll;
    	while(c > 0) {
    		digit += c % 10;
    		c = c / 10;
    	}
    	return digit;
	    };
    while(true) {
    	if(total <= 9) {
    		break;
    	}
    	total = f(total);
    }
    cout << total << endl;
}
0