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:为什么output exceed 呢In Reply To:为什么output exceed 呢 Posted by:niuniu2006 at 2007-04-09 15:46:19 > #include <iostream> > #include <cmath> > using namespace std; > > int main() > { > char a[60]; > int m; > > int jjj=0; > int i=0; > > int j=0; > double sum=0; > int jj=0; > double tem; > int jjjj=0; > int b[60]; > while(1) > { > at: for(i = 0;i<100;i++) > { > a[i] = cin.get(); > if(a[i]=='\n') > { > m=i; > break; > } > } > if((a[0]-'0')*(i)>=10) > { > for(jj=0;jj<=i-1;++jj) > cout<<a[jj]; > cout<<" is not cyclic"<<endl; > } > else > { > sum=0; > for(j=0;j<=i-1;++j) > { > sum+=pow(10,i-1-j)*(a[j]-'0'); > } > > for(jj=1;jj<=i-1;++jj) > { > tem=sum*(jj+1); > for(jjj=0;jjj<=i-1;++jjj) > { > b[jjj]=int(tem/pow(10,i-1-jjj)); > tem=tem-b[jjj]*pow(10,i-1-jjj); > } > > for(jjj=0;jjj<=i-1;++jjj) > { > if(b[jjj]==(a[0]-'0')) > j=jjj; > } > for(jjj=0;jjj<=i-1;++jjj) > { > if((a[jjj]-'0')!=b[(jjj+j)%i]) > { > for(jjjj=0;jjjj<=i-1;++jjjj) > cout<<a[jjjj]; > cout<<" is not cyclic"<<endl; > goto at; > } > > > } > > > > > > > } > for(jjjj=0;jjjj<=i-1;++jjjj) > cout<<a[jjjj]; > cout<<" is cyclic"<<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