| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪个大神指下,为什么都是 WA 蛋都碎咯!!! 或者给组BT的数据吧#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char ch[1500];
int i,j;
char tmp[1500];
while(cin >> ch)
{
int len = strlen(ch);
for(i = 0; i < len; i++)
{
if(i + 1 < len && ch[i] == ch[i+1])
{
j = 0;
tmp[j] = ch[i];
j++;
i++;
while(j < 9 && i < len && ch[i] == ch[i-1])
{
tmp[j++] = ch[i];
i++;
}
cout << j << tmp[0];
i--;
}
else
{
cout << "1";
while(i < len)
{
if(i + 1 < len && ch[i] == ch[i+1])
break;
cout << ch[i];
if(ch[i] == '1')
cout << "1";
i++;
}
i--;
cout << "1";
}
}
cout << endl;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator