結果

問題 No.933 おまわりさんこいつです
ユーザー rieaaddlreiuu
提出日時 2022-11-09 22:41:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 1,564 ms
コンパイル使用メモリ 166,192 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 03:38:21
合計ジャッジ時間 2,587 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int N;
    scanf("%d",&N);
    long temp;
    bool zero_flag = false;
    int ans = 1;
    for(int i=0;i<N;i++){
        scanf("%ld",&temp);
        if(temp == 0){
            zero_flag = true;
        }
        ans *= temp % 9;
        ans = ans % 9;
    }
    if(ans == 0){
        ans = 9;
    }
    if(zero_flag){
        ans = 0;
    }
    printf("%d",ans);
}
0