結果
問題 | No.933 おまわりさんこいつです |
ユーザー |
|
提出日時 | 2019-11-29 22:23:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 571 ms |
コンパイル使用メモリ | 27,392 KB |
最終ジャッジ日時 | 2025-01-08 06:04:03 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | int N; scanf("%d", &N); | ~~~~~^~~~~~~~~~ main.cpp:10:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | i64 pi; scanf("%ld", &pi); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdint> #include <cstdio> using namespace std; using i64 = int64_t; int main(void) { int N; scanf("%d", &N); i64 res = 1; for(int i=0; i<N; ++i) { i64 pi; scanf("%ld", &pi); if(pi == 0) { puts("0"); return 0; } res *= pi % 9; res %= 9; } if(res == 0) { res = 9; } printf("%ld\n", res); return 0; }