結果
問題 |
No.289 数字を全て足そう
|
ユーザー |
![]() |
提出日時 | 2025-03-07 16:20:26 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 227 bytes |
コンパイル時間 | 376 ms |
コンパイル使用メモリ | 24,576 KB |
実行使用メモリ | 8,604 KB |
最終ジャッジ日時 | 2025-03-07 16:20:28 |
合計ジャッジ時間 | 1,600 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%s", input); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { char input[10001]; char* p; int i, sum = 0; scanf("%s", input); for (p = input; *p != '\0'; p++){ if (*p >= '0' && *p <= '9'){ sum += (*p - '0'); } } printf("%d\n", sum); }