結果

問題 No.933 おまわりさんこいつです
ユーザー kyoprounokyoprouno
提出日時 2019-11-29 23:26:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 592 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 164,264 KB
実行使用メモリ 11,832 KB
最終ジャッジ日時 2023-08-13 06:54:11
合計ジャッジ時間 8,066 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:26:19: 警告: ‘sum_2’ may be used uninitialized [-Wmaybe-uninitialized]
   26 |             sum_2 += (mul%10);
      |             ~~~~~~^~~~~~~~~~~
main.cpp:24:19: 備考: ‘sum_2’ はここで定義されています
   24 |         long long sum_2;
      |                   ^~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(){
    long long n;
    cin >> n;
    long long mul=1;
    for(int i=0;i<n;i++){
        long long q;
        cin >> q;
        if(q>9){
            long long sum_1=0;
            while(q!=0){
                sum_1 += (q%10);
                q/=10;
                
            }
            q=sum_1;
        }
        mul*=q;
    }
    while(mul>9){
        long long sum_2;
        while(mul!=0){
            sum_2 += (mul%10);
            mul/=10;
            
        }
        mul=sum_2;
    }
    
    cout << mul << endl;
    
}
0