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了,第二次重沾了一下,188Ms AC了!你看看我的代码是不是比你的还懒!In Reply To:哪位给个快点的方法啊.. 我居然3000多ms, 太丢脸了. 话说本人很懒,用stl了. Posted by:lijinwu at 2010-04-12 18:01:20 #include<stdio.h> #include<string.h> char a[1010]; int main() { int i,n; scanf("%d",&n); getchar(); while(n--) { int l,i=0; scanf("%s",a); l=strlen(a); int m=1; while(i<l) { if(a[i]==a[i+1]) { m++; i++; } else { printf("%d%c",m,a[i]); m=1; i++; } } putchar('\n'); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator