#include "stdio.h"
#include "string.h"
#define maxn 10000000 + 10
int main()
{
char s[maxn];
scanf("%s",s);
int tot = 0;
for (int i = 0;i<strlen(s);i++)
{
if (s[i] == '1')
tot++;
}
printf("%d\n",tot);
}
书上的思考题,说是这段代码一个地方导致效率低下,请指出是哪里,我实在看不出哪里可以再快了。