| ||||||||||
| 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 | |||||||||
Re:哪位给个快点的方法啊.. 我居然3000多ms, 太丢脸了. 话说本人很懒,用stl了.In Reply To:哪位给个快点的方法啊.. 我居然3000多ms, 太丢脸了. 话说本人很懒,用stl了. Posted by:lijinwu at 2010-04-12 18:01:20 #include<stdio.h>
int main()
{
char temp[1500]={0},b=0;
int i=0,n=0,k=0;
scanf("%d",&n);
while(n--)
{
scanf("%s",temp);
b=temp[0];
k=1;
for(i=1;temp[i];i++)
{
if(temp[i]==b)
{
k++;
}
else
{
printf("%d%c",k,b);
b=temp[i];
k=1;
}
}
printf("%d%c\n",k,b);
}
}
200+MS
用c吧
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator