結果
| 問題 |
No.933 おまわりさんこいつです
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-01 20:41:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 702 bytes |
| コンパイル時間 | 3,964 ms |
| コンパイル使用メモリ | 336,116 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2025-03-01 20:41:19 |
| 合計ジャッジ時間 | 9,982 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 TLE * 1 -- * 1 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
// 各桁の和を求める関数
long long digit_sum(const string &x) {
long long res = 0;
for (char c : x) {
res += c - '0';
}
return res;
}
int main() {
int n;
cin >> n;
vector<long long> x(n);
for (int i = 0; i < n; ++i) {
cin >> x[i];
}
cpp_int y = 1;
for (long long k : x) {
y *= k;
}
string y_str = y.str();
while (y_str.length() != 1) {
y_str = to_string(digit_sum(y_str));
}
cout << y_str << endl;
return 0;
}