結果

問題 No.289 数字を全て足そう
ユーザー Maeda
提出日時 2025-03-03 14:37:22
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 365 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 25,344 KB
実行使用メモリ 15,048 KB
最終ジャッジ日時 2025-03-03 14:37:27
合計ジャッジ時間 4,958 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 1 -- * 2
other -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

void main(void){
	char str[10000];
    int inputStr =scanf("%s\n",str);
    if(inputStr == 2){
    	printf("文字列の入力ミス\n");
    }
	int sum = 0 , i = 0 ;
	while(str[i] != '\0'){
		int charNum = str[i] - '0';
		if(charNum >= 0 && charNum <= 9){
			sum += charNum;
		}	
	}
	printf("%d\n",sum);
}
0