結果
問題 | No.289 数字を全て足そう |
ユーザー |
|
提出日時 | 2019-04-01 18:21:07 |
言語 | C (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 282 bytes |
コンパイル時間 | 1,260 ms |
コンパイル使用メモリ | 27,520 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-25 19:16:58 |
合計ジャッジ時間 | 5,420 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 21 |
コンパイルメッセージ
main.c: In function 'main': main.c:11:17: warning: passing argument 1 of 'atoi' makes pointer from integer without a cast [-Wint-conversion] 11 | r=atoi(i[l]); | ~^~~ | | | char In file included from /usr/include/features.h:486, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/stdio.h:27, from main.c:1: /usr/include/stdlib.h:362:1: note: expected 'const char *' but argument is of type 'char' 362 | __NTH (atoi (const char *__nptr)) | ^~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char i[10000]; long a=0; short int r=0; scanf("%s",i); for(int l=0; l<=strlen(i); l++) { r=atoi(i[l]); if(r!=0) { a+=r; } } printf("%d",r); }