結果
| 問題 |
No.289 数字を全て足そう
|
| コンテスト | |
| ユーザー |
kazuki232
|
| 提出日時 | 2017-02-04 01:27:35 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 205 bytes |
| コンパイル時間 | 125 ms |
| コンパイル使用メモリ | 20,864 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 06:06:34 |
| 合計ジャッジ時間 | 2,432 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 RE * 12 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[5000]’ [-Wformat=]
5 | scanf("%s",&bun);
| ~^ ~~~~
| | |
| | char (*)[5000]
| char *
main.c:8:4: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
8 | if(abs(bun[i[0]]-53)<=4){i[1]+=(bun[i[0]]-48);}
| ^~~
main.c:2:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abs’
1 | #include <stdio.h>
+++ |+#include <stdlib.h>
2 | int main(){
main.c:5:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%s",&bun);
| ^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
int i[2];
char bun[5000];
scanf("%s",&bun);
i[0]=0;i[1]=0;
while(bun[i[0]]!='\0'){
if(abs(bun[i[0]]-53)<=4){i[1]+=(bun[i[0]]-48);}
i[0]++;
}
printf("%d\n",i[1]);
return 0;
}
kazuki232