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 |
1125MS,究竟测试数据有多庞大?#include <stdio.h> #include <string.h> int main() { char s[1001]; int t,i,num=1,len; scanf("%d",&t); while(t--) { scanf("%s",s); len=strlen(s); for(i=1;i<=len;i++) { if(s[i]==s[i-1]) num++; else { printf("%d%c",num,s[i-1]); num=1; } } printf("\n"); } return 0; } O(N)都要1125MS了、、、 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator