結果

問題 No.933 おまわりさんこいつです
ユーザー shop_one
提出日時 2019-11-29 21:48:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 65,844 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-20 21:52:18
合計ジャッジ時間 1,693 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll val(ll n){
  ll res=0;
  while(n>0){
    res += n%10;
    n/=10;
  }
  return res;
}
signed main(){
  ll n,v;
  cin >> n;
  ll p[n];
  for(int i=0;i<n;i++){
    cin >> p[i];
    if(i==0){
      v = p[i];
      while(v>=10){
        v = val(v);
      }
    }else{
      v *= p[i];
      while(v>=10){
        v = val(v);
      }
    }
  }
  cout << v << endl;
}
0