結果

問題 No.933 おまわりさんこいつです
ユーザー jjjjjjjtgpptmjjjjjjjjjtgpptmjj
提出日時 2019-11-29 21:54:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 1,500 bytes
コンパイル時間 1,309 ms
コンパイル使用メモリ 147,220 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-13 05:22:39
合計ジャッジ時間 2,808 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = 1e9;
const ll INFLL = 1e18;
const ll MOD = 1e9+7;
const double PI = acos(-1.0);

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

/*------------------------------------/
for library*/

/*------------------------------------*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N;
    cin>>N;
    vector<ll> P(N);
    rep(i,N){
        cin>>P[i];
    }
    int K = 1;
    rep(i,N){
        string x = to_string(P[i]);
        int tmp = 0;
        rep(j,(int)x.size()){
            tmp += x[j] - '0';
        }
        K *= tmp;
        while(to_string(K).size()>1){
            string K_st = to_string(K);
            int cnt = 0;
            rep(j,(int)K_st.size()){
                cnt += K_st[j]-'0';
            }
            K = cnt;
        }
    }
    cout<<K<<endl;
}
0