結果

問題 No.933 おまわりさんこいつです
ユーザー kappybar
提出日時 2020-03-26 11:14:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 1,555 ms
コンパイル使用メモリ 167,176 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-01-02 01:02:26
合計ジャッジ時間 2,630 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;


int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    if(a[0] == 0){
        cout << 0 << endl;
        return 0;
    }
    int ans = 1;
    rep(i,n){
        a[i] %= 9;
        ans *= a[i];
        ans %= 9;
    }
    if(ans ==0) cout << 9 << endl;
    else cout << ans << endl;
    

    return 0;  
}
0