HDOJ 2017 题 题目见正文
提交之后显示Runtime Error
(ACCESS_VIOLATION) 求助!
#include"iostream"
using namespace std;
int main()
{
int n,count;
while (cin >> n)
{
fflush(stdin);
count = 0;
char **p;
p = (char **)calloc(n, sizeof(char));
for (int i = 0; i < n; i++)
p[i] = (char *)calloc(100, sizeof(char));
for (int i = 0; i < n; i++)
{
gets(p[i]);
fflush(stdin);
}
for (int i = 0; i < n; i++)
{
for (int j = 0; p[i][j] != '\0'; j++)
{
if (p[i][j] >= '0' && p[i][j] <= '9')
count++;
}
cout << count << endl;
count = 0;
}
}
}