結果
問題 | No.933 おまわりさんこいつです |
ユーザー |
![]() |
提出日時 | 2019-11-30 17:14:33 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 74 ms / 2,000 ms |
コード長 | 398 bytes |
コンパイル時間 | 719 ms |
コンパイル使用メモリ | 65,060 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-21 01:28:27 |
合計ジャッジ時間 | 1,960 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include<iostream> #include<cstring> #include<vector> #include<algorithm> using namespace std; typedef long long ll; int main(){ int n; cin>>n; vector<ll>p(n); for(int i=0;i<n;i++){ cin>>p[i]; } sort(p.begin(),p.end()); ll ans=1; if(p[0]==0){ cout<<0<<endl; return 0; } for(int i=0;i<n;i++){ p[i]%=9; ans*=p[i]; ans%=9; } if(ans==0)cout<<9<<endl; else cout<<ans<<endl; }