/ 科创班 /

记录详情

Wrong Answer

/in/foo.c: In function 'main':
/in/foo.c:31:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   if (c == '\n')
   ^~
/in/foo.c:33:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
    break;
    ^~~~~
/in/foo.c:27:10: warning: variable 'str' set but not used [-Wunused-but-set-variable]
     char str[N+1], c;
          ^~~
# 状态 耗时 内存占用
#1 Wrong Answer 0ms 188.0 KiB
#2 Wrong Answer 0ms 184.0 KiB
#3 Wrong Answer 0ms 204.0 KiB
#4 Wrong Answer 0ms 188.0 KiB
#5 Wrong Answer 0ms 188.0 KiB
#6 Wrong Answer 0ms 204.0 KiB
#7 Wrong Answer 0ms 188.0 KiB
#8 Wrong Answer 0ms 188.0 KiB
#9 Wrong Answer 0ms 200.0 KiB
#10 Wrong Answer 0ms 188.0 KiB

代码

#include <stdio.h>
#include <ctype.h>
#define N 100

void
count(char *str)
{
    int alpha = 0, num = 0, space = 0, other = 0;
    for (char *p=str; *p != '\0'; p++)
    {
        if (isalpha(*p))
            alpha++;
        else if (isalnum(*p))
            num++;
        else if (isspace(*p))
            space++;
        else
            other++;
    }
    printf("%d\n%d\n%d\n%d", alpha, num, space, other);
}


int
main(void)
{
    char str[N+1], c;
	for (int i=0; i < N; i++)
	{	
        c = getchar();
		if (c == '\n')
			str[i] = '\0';
			break;
		str[i] = c;
    }

    return 0;
}

信息

递交者
类型
递交
题目
7.9统计个数
题目数据
下载
语言
C
递交时间
2018-10-26 11:20:20
评测时间
2018-10-26 11:20:20
评测机
分数
0
总耗时
9ms
峰值内存
204.0 KiB