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:菜鸟,水过30~嘿嘿,加油~In Reply To:菜鸟,水过30~嘿嘿,加油~ Posted by:zjc0823 at 2010-04-12 16:46:22 #include<iostream> #include<string> using namespace std; int main() { int x; cin>>x; while(x--){ char s[2000]; cin>>s; int a[2000],b[2000],le=strlen(s),i,j,t=0,us[2000]={0},m; for(i=0;i<le;i++){ if(us[i]==1) break; else{ a[t]=s[i]-'0'; int c=0; for(j=i;;j++){ if(s[j]!=s[i]) break; else {c++;us[j]=1;} } b[t]=c; i+=c-1; t++; } } for(m=0;m<t;m++) printf("%d%d",b[m],a[m]); cout<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator