結果
問題 | No.289 数字を全て足そう |
ユーザー |
![]() |
提出日時 | 2020-03-27 02:10:54 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 293 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 24,960 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-02 07:48:59 |
合計ジャッジ時間 | 947 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:13: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[10000]’ [-Wformat=] 7 | scanf("%s",&input); | ~^ ~~~~~~ | | | | | char (*)[10000] | char * main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%s",&input); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> void main(){ char input[10000]; int ans = 0; scanf("%s",&input); for(int i=0;input[i] != '\0';i++){ if(input[i] >= '0' && input[i] <= '9') ans += ( (int)input[i] - (int)'0' ); } printf("%d",ans); return; }