結果
問題 | No.933 おまわりさんこいつです |
ユーザー |
![]() |
提出日時 | 2019-11-29 22:03:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 70 ms / 2,000 ms |
コード長 | 581 bytes |
コンパイル時間 | 1,449 ms |
コンパイル使用メモリ | 169,132 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-20 22:18:10 |
合計ジャッジ時間 | 2,485 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include<bits/stdc++.h> #define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i) #define rep(i,a,b) for(int i=int(a);i<int(b);++i) #define All(x) (x).begin(),(x).end() using namespace std; using ll = long long; int main(){ int N;cin>>N; vector<ll> P(N); REP(i,N) cin>>P[i]; ll ans=1; bool zero=false; REP(i,N){ ll q=P[i]; if(q==0) zero=true; ll d=0; while(q){ d+=q%10; q/=10; } d%=9; ans*=d; ans%=9; } if(zero) cout<<0<<endl; else cout<<(ans?ans:9)<<endl; }