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:我的代码,,,,,runtime error 了N 次,还是没找到错在哪,哪位大牛帮我看一下,谢了!!In Reply To:我的代码,,,,,runtime error 了N 次,还是没找到错在哪,哪位大牛帮我看一下,谢了!! Posted by:scaneeling at 2008-07-27 15:03:38 > #include<iostream> > #include<string> > using namespace std; > int main() > { > int k1,k2,k3,i,len,j,k,a[1000],num; > char ch1[1000],ch2[1000],ch3[1000]; > string s; > while(true) > { > > cin>>k1>>k2>>k3; > if(k1==0&&k2==0&&k3==0) > break; > cin>>s; > len=s.size(); > j=0; > k=0; > for(i=0;i!=len;++i) > { > if(s[i]>='a'&&s[i]<='i') > { > ch1[k++]=s[i]; > a[j++]=i+1; > } > } > k1=(k1+j)%j; > for(i=0;i!=j;++i) > { > num=(i-k1+j)%j; > s[a[i]-1]=ch1[num]; > } > //cout<<s<<endl; > k=0; > j=0; > for(i=0;i!=len;++i) > { > if(s[i]>='j'&&s[i]<='r') > { > ch2[k++]=s[i]; > a[j++]=i+1; > } > } > k2=(k2+j)%j; > for(i=0;i!=j;++i) > { > num=(i-k2+j)%j; > s[a[i]-1]=ch2[num]; > } > //cout<<s<<endl; > k=0; > j=0; > for(i=0;i!=len;++i) > { > if(s[i]>='s'&&s[i]<='z'||s[i]=='_') > { > ch3[k++]=s[i]; > a[j++]=i+1; > } > } > k3=(k3+j)%j; > for(i=0;i!=j;++i) > { > num=(i-k3+j)%j; > s[a[i]-1]=ch3[num]; > } > cout<<s<<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