結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2025-03-03 14:31:11 |
言語 | C (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 219 bytes |
コンパイル時間 | 454 ms |
コンパイル使用メモリ | 24,192 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-03-03 14:31:13 |
合計ジャッジ時間 | 1,948 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 21 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:10:40: warning: passing argument 1 of ‘atoi’ makes pointer from integer without a cast [-Wint-conversion] 10 | sum += atoi(str[i]); | ~~~^~~ | | | char In file included from /usr/include/features.h:502, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:28, from main.c:1: /usr/include/stdlib.h:481:1: note: expected ‘const char *’ but argument is of type ‘char’ 481 | __NTH (atoi (const char *__nptr)) | ^~~~~
ソースコード
#include <stdio.h> #include <ctype.h> #include <stdlib.h> void main(void){ char str[100000]; int sum = 0 , i = 0 ; while(str[i] != '\0'){ if(isdigit(str[i])){ sum += atoi(str[i]); } } printf("%d\n",sum); }