結果

問題 No.933 おまわりさんこいつです
ユーザー 🍮かんプリン
提出日時 2019-11-29 21:55:12
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 576 bytes
コンパイル時間 1,380 ms
コンパイル使用メモリ 160,140 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-20 22:03:05
合計ジャッジ時間 2,714 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int f(ll x) {
    if (x < 10) return x;
    int res = 0;
    while (x) {
        res += x % 10;
        x /= 10;
    }
    return f(res);
}

int main() {
    int n;
    cin >> n;
    ll ans = 1;
    REP(i, n) {
        ll p; cin >> p;
        ans *= f(p);
        ans = f(ans);
    }
    cout << ans << endl;
    return 0;
}
0