結果
問題 |
No.933 おまわりさんこいつです
|
ユーザー |
![]() |
提出日時 | 2020-02-25 01:13:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 354 bytes |
コンパイル時間 | 2,069 ms |
コンパイル使用メモリ | 192,856 KB |
最終ジャッジ日時 | 2025-01-09 02:09:20 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 ‘int64_t’ {aka ‘long int’} [-Wformat=] 18 | printf("%d\n", ans); | ~^ ~~~ | | | | int int64_t {aka 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) %= 9; } if (ans == 0) ans = 9; printf("%d\n", ans); }