結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,756 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 TLE -
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:27:19: 警告: ‘sum_2’ may be used uninitialized [-Wmaybe-uninitialized]
   27 |             sum_2 += (mul%10);
      |             ~~~~~~^~~~~~~~~~~
main.cpp:25:19: 備考: ‘sum_2’ はここで定義されています
   25 |         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;
        long long sum_1=0;
        while(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