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 |
为什么超时呢?#include <stdio.h> #include <string.h> #define SIZE 1001 int main() { int i, count; int cases; char in[SIZE]; scanf("%d", &cases); while(cases--) { scanf("%s", in); for(i = 0, count = 1; i < (strlen(in) - 1); i++) { if(in[i] == in[i + 1]) count++; else { printf("%d%d", count, in[i] - 48); count = 1; } } printf("%d%d\n", count, in[i] - 48); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator