結果

問題 No.289 数字を全て足そう
ユーザー piyoko_212
提出日時 2015-12-28 21:08:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 211 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 32,844 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-08 00:37:32
合計ジャッジ時間 1,039 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%s",in);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<algorithm>
using namespace std;
char in[110000];
int main(){
	scanf("%s",in);
	int ret=0;
	for(int i=0;in[i];i++){
		if('0'<=in[i]&&in[i]<='9')ret+=in[i]-'0';
	}
	printf("%d\n",ret);
}
0