結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2018-03-12 02:31:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 281 bytes |
コンパイル時間 | 441 ms |
コンパイル使用メモリ | 36,300 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-15 17:46:18 |
合計ジャッジ時間 | 1,215 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%s", s); | ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h> #include <algorithm> #include <deque> using namespace std; using ll = long long; //289 int main() { int sum = 0; char s[10001]; scanf("%s", s); for (int p = 0; s[p] != 0; p++) if ('1' <= s[p] && s[p] <= '9') sum += s[p] - '0'; printf("%d\n", sum); }