結果
| 問題 |
No.933 おまわりさんこいつです
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2020-02-25 00:48:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 317 bytes |
| コンパイル時間 | 2,306 ms |
| コンパイル使用メモリ | 190,500 KB |
| 最終ジャッジ日時 | 2025-01-09 02:07:04 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 22 |
コンパイルメッセージ
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);
| ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans = 0;
scanf("%d", &n);
char c;
while ((c = getchar()) != '\n') {
if (c == ' ') continue;
ans += c - '0';
}
if (ans && ans % 9 == 0) {
puts("9");
} else {
printf("%d\n", ans % 9);
}
}
trineutron