結果
| 問題 | No.933 おまわりさんこいつです |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-31 15:50:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 302 bytes |
| 記録 | |
| コンパイル時間 | 353 ms |
| コンパイル使用メモリ | 22,656 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-19 02:21:26 |
| 合計ジャッジ時間 | 1,121 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lld", &tmp);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main() {
int n, ans = 1;
long long int tmp;
bool zero = false;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%lld", &tmp);
if (tmp == 0) zero = true;
tmp %= 9;
ans = ans * tmp % 9;
}
if (ans == 0 && !zero) ans = 9;
printf("%d\n", ans);
}