結果
| 問題 | No.933 おまわりさんこいつです |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-01 20:42:22 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 794 bytes |
| 記録 | |
| コンパイル時間 | 3,637 ms |
| コンパイル使用メモリ | 377,900 KB |
| 実行使用メモリ | 13,988 KB |
| 最終ジャッジ日時 | 2026-07-06 14:34:18 |
| 合計ジャッジ時間 | 8,701 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 TLE * 1 -- * 1 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#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;
}