結果
| 問題 | No.289 数字を全て足そう |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-29 14:25:53 |
| 言語 | C (gcc 15.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 411 bytes |
| 記録 | |
| コンパイル時間 | 1,260 ms |
| コンパイル使用メモリ | 38,016 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-29 14:26:12 |
| 合計ジャッジ時間 | 2,662 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 21 |
コンパイルメッセージ
main.c: In function 'main':
main.c:13:16: warning: comparison between pointer and integer
13 | if (*s == NULL) {
| ^~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main(void)
{
char *s;
int total = 0;
int i;
s = malloc(10000 * sizeof(char));
if (*s == NULL) {
printf("記憶域の確保に失敗しました。");
} else {
scanf("%s", s);
for (i = 0; i < strlen(s); i++)
if (isdigit(s[i]))
total += s[i] - '0';
printf("%d\n", total);
free(s);
}
return 0;
}