結果
問題 |
No.933 おまわりさんこいつです
|
ユーザー |
![]() |
提出日時 | 2019-12-07 20:26:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 1,973 ms |
コンパイル使用メモリ | 165,700 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 06:10:04 |
合計ジャッジ時間 | 3,338 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; long p[n]; long long total = 1LL; for(int i = 0; i < n; i++) { cin >> p[i]; total *= p[i]; } cout << total << endl; auto f = [&] (ll c) { ll digit = 0ll; while(c > 0) { digit += c % 10; c = c / 10; } return digit; }; while(true) { if(total <= 9) { break; } total = f(total); } cout << total << endl; }