結果

問題 No.933 おまわりさんこいつです
ユーザー hirono999hirono999
提出日時 2019-11-29 23:09:32
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 1,289 bytes
コンパイル時間 1,572 ms
コンパイル使用メモリ 168,184 KB
実行使用メモリ 4,772 KB
最終ジャッジ日時 2023-08-13 06:51:43
合計ジャッジ時間 2,825 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 10 ms
4,436 KB
testcase_18 AC 1 ms
4,384 KB
testcase_19 AC 13 ms
4,760 KB
testcase_20 AC 10 ms
4,696 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 31 ms
4,772 KB
testcase_24 AC 31 ms
4,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0; i<(n); ++i)
#define rep1(i,n) for(ll i=1; i<=(n); ++i)
#define repi(i,a,b) for(ll i=a; i<=(b); ++i)
#define rrep(i,n) for(ll i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
using Edge = pair<ll,ll>;
using Graph = vector<vector<Edge>>;
typedef pair<ll,ll> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll devc(ll x, ll y){return 1 + (x-1)/y;}

ll digit_sum(ll N){
    string str = to_string(N);
    ll ret = 0;
    rep(i,sz(str)) ret += str[i] - '0';
    return ret;
}

ll solve(ll N, vector<ll> P){
    ll ans = 1;
    rep(i,N){
        ans *= P[i];
        while(ans >= 10) ans = digit_sum(ans);
    }
    return ans;
}

int main(){
    ll N; cin >> N;
    vector<ll> P(N); rep(i,N) cin >> P[i];
    pr(solve(N,P));
    return 0;
}
0