为什么我这代码还是超时

要求:时间复杂度为O(n),空间复杂度为O(1)。
一下是我的代码:

include

int main()
{
int a,b,c,d,i;
char ch;
a=b=c=d=0;
while((ch=getchar())!='\n')
{
if(ch=='a') a++;
else if(ch=='b') b++;
else if(ch=='c') c++;
else if(ch=='d') d++;
}
for(i=0;ifor(i=0;ifor(i=0;ifor(i=0;iprintf("\n");
return 0;
}[url]https://book.douban.com/douli...[/url]
[url]https://movie.douban.com/doul...[/url]
[url]https://www.douban.com/doulis...[/url]
[url]https://m.douban.com/doulist/...[/url]
[url]https://book.douban.com/douli...[/url]
[url]https://movie.douban.com/doul...[/url]
[url]https://www.douban.com/doulis...[/url]
[url]https://m.douban.com/doulist/...[/url]
[url]https://book.douban.com/douli...[/url]
[url]https://movie.douban.com/doul...[/url]
[url]https://www.douban.com/doulis...[/url]
[url]https://m.douban.com/doulist/...[/url]
[url]https://book.douban.com/douli...[/url]
[url]https://movie.douban.com/doul...[/url]
[url]https://www.douban.com/doulis...[/url]
[url]https://m.douban.com/doulist/...[/url]
[url]https://book.douban.com/douli...[/url]
[url]https://movie.douban.com/doul...[/url]
[url]https://www.douban.com/doulis...[/url]
[url]https://m.douban.com/doulist/...[/url]
[url]https://book.douban.com/douli...[/url]
[url]https://movie.douban.com/doul...[/url]
[url]https://www.douban.com/doulis...[/url]
[url]https://m.douban.com/doulist/...[/url]
[url]https://book.douban.com/douli...[/url]
[url]https://movie.douban.com/doul...[/url]
[url]https://www.douban.com/doulis...[/url]
[url]https://m.douban.com/doulist/...[/url]
[url]https://book.douban.com/douli...[/url]
[url]https://movie.douban.com/doul...[/url]

你可能感兴趣的:(cc++)