結果
問題 | No.933 おまわりさんこいつです |
ユーザー |
|
提出日時 | 2025-03-01 20:40:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 677 bytes |
コンパイル時間 | 5,108 ms |
コンパイル使用メモリ | 335,512 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-03-01 20:40:36 |
合計ジャッジ時間 | 8,080 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 WA * 3 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <boost/multiprecision/cpp_int.hpp> using namespace std; using namespace boost::multiprecision; // 各桁の和を求める関数 int digit_sum(const string &x) { int res = 0; for (char c : x) { res += c - '0'; } return res; } int main() { int n; cin >> n; vector<int> x(n); for (int i = 0; i < n; ++i) { cin >> x[i]; } cpp_int y = 1; for (int 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; }