結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
|
提出日時 | 2017-06-29 09:34:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 264 bytes |
コンパイル時間 | 1,243 ms |
コンパイル使用メモリ | 158,840 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 16:08:21 |
合計ジャッジ時間 | 2,049 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’: main.cpp:10:6: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%s",S); | ~~~~~^~~~~~~~
ソースコード
#include <bits/stdc++.h> using namespace std; int main(int argc, char **argv) { char S[10000]; int i; int total = 0; scanf("%s",S); for(i = 0;i<strlen(S);i++) { if((S[i]>='0') && (S[i]<='9')) { total += S[i] - '0'; } } printf("%d\n",total); return 0; }