作业帮 > 英语 > 作业

杭电 1020 无法AC

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/09 13:43:05
杭电 1020 无法AC
Problem Description
Given a string containing only 'A' - 'Z',we could encode it using the following method:
1.Each sub-string containing k same characters should be encoded to "kX" where "X" is the only character in this sub-string.
2.If the length of the sub-string is 1,'1' should be ignored.
Input
The first line contains an integer N (1 n;
\x05while(n--)
\x05{
\x05\x05t=0;
\x05\x05t1=0;
\x05\x05i=0;
\x05\x05gets(a);
\x05\x05while(a[i]!=NULL)
\x05\x05{
\x05\x05\x05count=1;
\x05\x05\x05while(a[i]==a[i+1])
\x05\x05\x05{
\x05\x05\x05\x05count++;
\x05\x05\x05\x05i++;
\x05\x05\x05}
\x05\x05\x05
\x05\x05\x05if(count==1)
\x05\x05\x05\x05cout
把 gets(a) 换成 cin >> a;
再问: 不一样吗?
再答: 不一样
再问: 为什么cin>>a可以ac?gets为什么不行?
再答: gets不忽略空格