結果
| 問題 |
No.933 おまわりさんこいつです
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2020-02-25 01:08:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 2,000 ms |
| コード長 | 346 bytes |
| コンパイル時間 | 2,301 ms |
| コンパイル使用メモリ | 190,856 KB |
| 最終ジャッジ日時 | 2025-01-09 02:08:51 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
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:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%ld", &p);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 1;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
int64_t p;
scanf("%ld", &p);
if (p == 0) {
puts("0");
return 0;
}
(ans *= p % 9) %= 9;
}
if (ans == 0) ans = 9;
printf("%d\n", ans);
}
trineutron