結果
問題 | No.289 数字を全て足そう |
ユーザー |
|
提出日時 | 2016-01-19 21:30:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 271 bytes |
コンパイル時間 | 314 ms |
コンパイル使用メモリ | 23,296 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-08 00:41:20 |
合計ジャッジ時間 | 1,274 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%s",s); | ~~~~~^~~~~~~~
ソースコード
#include<stdio.h> #include<string.h> int main(void){ int n,i,ans=0; char s[10010]; scanf("%s",s); n = strlen(s); for(i=0; i<n; i++){ if(s[i]>='0' && s[i]<='9'){ ans+=s[i]-'0'; } } printf("%d\n",ans); return 0; }