結果

問題 No.933 おまわりさんこいつです
ユーザー KKT89
提出日時 2019-12-19 12:25:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 707 ms
コンパイル使用メモリ 75,320 KB
最終ジャッジ日時 2025-01-08 12:39:07
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<ll> a(n);
    ll ans=1;
    for(int i=0;i<n;i++){
        cin >> a[i];
        ans*=a[i];
        while(ans>=10){
            ll d=0;
            while(ans){
                d+=ans%10;
                ans/=10;
            }
            ans=d;
        }
    }
    cout << ans << endl;
}
0