結果
問題 |
No.933 おまわりさんこいつです
|
ユーザー |
![]() |
提出日時 | 2020-02-25 01:16:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 350 bytes |
コンパイル時間 | 1,795 ms |
コンパイル使用メモリ | 192,620 KB |
最終ジャッジ日時 | 2025-01-09 02:09:32 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=] 18 | printf("%d\n", (ans ? ans : 9)); | ~^ ~~~~~~~~~~~~~~~ | | | | int long int | %ld main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%ld", &p); | ~~~~~^~~~~~~~~~~
ソースコード
#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; ans %= 9; } printf("%d\n", (ans ? ans : 9)); }