| ||||||||||
| 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:庆祝一下我的第6道题,贴一下,呵呵In Reply To:庆祝一下我的第6道题,贴一下,呵呵 Posted by:caonimama at 2006-08-30 10:50:44 > #include<iomanip.h>
> #include<string.h>
> int main()
> {
> char ch1[100],ch0[100],ch2[100],ch3[100],ch4[100];
> int k1,k2,k3,i,j,k11=0,k22=0,k33=0,x;
> cin>>k1>>k2>>k3;
> while(k1!=0||k2!=0||k3!=0)
> {
> cin>>ch0;
> x=strlen(ch0);
> int *a=new int[x+20];
> int *b=new int[x+20];
> int *c=new int[x+20];
> for(i=0;i<x;i++)
> {
> if(ch0[i]>='a'&&ch0[i]<='i')
> {
> ch1[k11]=ch0[i];
> a[k11++]=i;
>
> }
> if(ch0[i]>='j'&&ch0[i]<='r')
> {
> ch2[k22]=ch0[i];
> b[k22++]=i;
>
> }
> if((ch0[i]>='s'&&ch0[i]<='z')||ch0[i]=='_')
> {
> ch3[k33]=ch0[i];
> c[k33++]=i;
>
> }
>
> }
> while(k1>k11&&k11!=0)
> {
> k1=k1-k11;
> }
> while(k2>k22&&k22!=0)
> {
> k2=k2-k22;
> }
> while(k3>k33&&k33!=0)
> {
> k3=k3-k33;
> }
> if(k11==0)
> {
> k1=0;
> }
> if(k22==0)
> {
> k2=0;
> }
> if(k33==0)
> {
> k3=0;
> }
> for(i=0;i<k11-k1;i++)
> {
> char cha1=ch1[0];
> for(j=0;j<k11;j++)
> {
> ch1[j]=ch1[j+1];
> }
> ch1[k11-1]=cha1;
> }
> for(i=0;i<k11;i++)
> {
> ch4[a[i]]=ch1[i];
> }
> for(i=0;i<k22-k2;i++)
> {
> char cha2=ch2[0];
> for(j=0;j<k22;j++)
> {
> ch2[j]=ch2[j+1];
> }
> ch2[k22-1]=cha2;
> }
> for(i=0;i<k22;i++)
> {
> ch4[b[i]]=ch2[i];
> }
> for(i=0;i<k33-k3;i++)
> {
> char cha3=ch3[0];
> for(j=0;j<k33;j++)
> {
> ch3[j]=ch3[j+1];
> }
> ch3[k33-1]=cha3;
> }
> for(i=0;i<k33;i++)
> {
> ch4[c[i]]=ch3[i];
> }
> for(i=0;i<x;i++)
> {
> cout<<ch4[i];
> }
> cout<<endl;
> k11=k22=k33=0;
> 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