結果
| 問題 |
No.289 数字を全て足そう
|
| コンテスト | |
| ユーザー |
yycoder
|
| 提出日時 | 2019-12-08 22:23:03 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 212 bytes |
| コンパイル時間 | 1,350 ms |
| コンパイル使用メモリ | 24,576 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-01 17:24:45 |
| 合計ジャッジ時間 | 2,021 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%s", str);
| ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main()
{
char str[10000];
int total = 0;
scanf("%s", str);
for (int i = 0; str[i] != '\0'; i++) {
if (str[i] <= 57)
total += str[i] - 48;
}
printf("%d\n", total);
return 0;
}
yycoder