結果
問題 | No.289 数字を全て足そう |
ユーザー |
![]() |
提出日時 | 2015-10-16 22:23:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 260 bytes |
コンパイル時間 | 252 ms |
コンパイル使用メモリ | 34,304 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-07 20:03:39 |
合計ジャッジ時間 | 969 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:42: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | char s[10001];int len,ans=0;scanf("%s",s); | ~~~~~^~~~~~~~
ソースコード
#include <cstdio>#include <cstring>#include <algorithm>using namespace std;//namaega184int main(){char s[10001];int len,ans=0;scanf("%s",s);len=strlen(s);for(int i=0;i<len;i++)if(s[i]>='0'&&s[i]<='9')ans+=s[i]-'0';printf("%d\n",ans);return 0;}