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 |
my solution似乎不太难呢 好像有个叫做O(n)扫描的东西 #include <stdio.h> long n; void work() { char s[2000]; long l,i; long ans; scanf("%s",s); l=strlen(s); s[l]=10; ans=0; for(i=0;i<l;i++) { ans++; if(s[i]!=s[i+1]) { printf("%ld%ld",ans,s[i]-'0'); ans=0; } } printf("\n"); } int main() { long i; scanf("%ld",&n); for(i=1;i<=n;i++) work(); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator