結果

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

ソースコード

diff #

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

using ll = long long;

int main() {
    int n;
    cin >> n;
    ll res = 1;
    for (int i = 0; i < n; i++) {
        ll a;
        cin >> a;
        if (a == 0) {
            cout << 0 << endl;
            return 0;
        }
        else {
            res *= a % 9 == 0 ? 9 : a % 9;
            res = res % 9 == 0 ? 9 : res % 9;
        }
    }
    
    cout << (res % 9 == 0 ? 9 : res % 9) << endl;
}
0