結果

問題 No.933 おまわりさんこいつです
コンテスト
ユーザー trineutron
提出日時 2020-02-25 01:12:38
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
RE  
実行時間 -
コード長 353 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,303 ms
コンパイル使用メモリ 207,676 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-08 20:49:01
合計ジャッジ時間 4,972 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:10:14: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized]
   10 |         scanf("%ld", p);
      |         ~~~~~^~~~~~~~~~
main.cpp:9:17: note: 'p' was declared here
    9 |         int64_t p;
      |                 ^

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    scanf("%d", &n);
    int64_t ans = 1;
    for (int i = 0; i < n; i++) {
        int64_t p;
        scanf("%ld", p);
        if (p == 0) {
            puts("0");
            return 0;
        }
        (ans *= p) %= 9;
    }
    if (ans == 0) ans = 9;
    printf("%d\n", ans);
}
0