結果
| 問題 | No.289 数字を全て足そう |
| コンテスト | |
| ユーザー |
funakoshi
|
| 提出日時 | 2019-08-19 17:48:33 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 428 bytes |
| 記録 | |
| コンパイル時間 | 151 ms |
| コンパイル使用メモリ | 40,896 KB |
| 最終ジャッジ日時 | 2026-02-22 04:23:18 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
int main(void)
{
char str[11000]="";
char num[]={'1','2','3','4','5','6','7','8','9'};
int total=0;
scanf("%s",str);
for(int i=0;i<strlen(str);i++)
{
for(int j=0;j<9;j++)
{
if(str[i]==num[j])
{
total+=num[j]-'0';
}
}
}
printf("%d",total);
}
funakoshi