結果
| 問題 | No.933 おまわりさんこいつです |
| コンテスト | |
| ユーザー |
w1steri4sec
|
| 提出日時 | 2020-03-05 09:29:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 938 bytes |
| 記録 | |
| コンパイル時間 | 1,384 ms |
| コンパイル使用メモリ | 169,944 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 00:47:25 |
| 合計ジャッジ時間 | 2,224 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
// ll sumketa(ll x){
// ll k=x;
// ll wa=0;
// while(k>0){
// wa+=k%10;
// k/=10;
// }
// if(wa<10){
// return wa;
// }else{
// return sumketa(wa);
// }
// }
int main(){
cin.tie( 0 ); ios::sync_with_stdio( false );
int n;
cin >> n;
vector<ll> p(n);
rep(i,n) cin >> p[i];
ll ans=1;
rep(i,n){
if(p[i]==0){
cout << 0 << endl;
return 0;
}
p[i]%=9;
ans*=p[i];
ans%=9;
}
if(ans==0){
cout << 9 << endl;
return 0;
}else{
cout << ans << endl;
return 0;
}
}
w1steri4sec