結果
問題 | No.933 おまわりさんこいつです |
ユーザー |
|
提出日時 | 2019-11-29 21:51:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 1,562 ms |
コンパイル使用メモリ | 167,344 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-20 21:57:06 |
合計ジャッジ時間 | 2,659 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) typedef pair<int, int> P; typedef long long ll; ll culc(ll a){ while(a>=10){ ll tmp = 0; string s = to_string(a); for(auto i:s){ tmp+=(i-'0'); } a = tmp; } return a; } int main(){ int n; cin >> n; ll res = 1; rep(i,n){ ll p; cin >> p; res = culc(res*p); } cout << res << endl; return 0; }