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:高手们,可不可以帮我看看程序,为什么我自己运行题目给出的数据时,是正确的,但是提交上去的结果却是错的呢?真是想不明白~~In Reply To:高手们,可不可以帮我看看程序,为什么我自己运行题目给出的数据时,是正确的,但是提交上去的结果却是错的呢?真是想不明白~~ Posted by:ccnuteam4 at 2008-08-25 10:42:46 > #include <iostream> > > using namespace std; > > int main() > { > int k1,k2,k3,i,i1,i2,i3,j1,j2,j3; > char str[81],str1[81],str2[81],str3[81]; > cin>>k1>>k2>>k3; > while(k1!=0&&k2!=0&&k3!=0) > { > cin>>str; > j1=0; > j2=0; > j3=0; > for(i=0;str[i]!='\0';i++) > { > if(str[i]>='a'&&str[i]<='i') > { > str1[j1]=str[i]; > j1++; > } > else if(str[i]>='j'&&str[i]<='r') > { > str2[j2]=str[i]; > j2++; > } > else > { > str3[j3]=str[i]; > j3++; > } > } > i1=0; > i2=0; > i3=0; > for(i=0;str[i]!='\0';i++) > { > if(str[i]>='a'&&str[i]<='i') > { > if(k1) > { > str[i]=str1[j1-k1]; > k1--; > } > else > { > str[i]=str1[i1]; > i1++; > } > } > else if(str[i]>='j'&&str[i]<='r') > { > if(k2) > { > str[i]=str2[j2-k2]; > k2--; > } > else > { > str[i]=str2[i2]; > i2++; > } > } > else > { > if(k3) > { > str[i]=str3[j3-k3]; > k3--; > } > else > { > str[i]=str3[i3]; > i3++; > } > } > } > cout<<str<<endl; > cin>>k1>>k2>>k3; > } > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator