| ||||||||||
| 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:2247!!help!!!In Reply To:2247!!help!!! Posted by:njutcmn at 2006-08-17 15:42:52 > the result is "wrong anser!!",why???
> language:C++
>
> #include<iostream.h>
> void main()
> {
> int i,j,m=0;
> int *qq;
> qq=new int[10000];
> long int a[10000],b[4][3],k=0;
> a[1]=1;a[2]=2;a[3]=3;a[4]=4;a[5]=5;a[6]=6;a[7]=7;
> b[0][0]=2;b[0][1]=4;b[0][2]=8;
> b[1][0]=3;b[1][1]=3;b[1][2]=9;
> b[2][0]=5;b[2][1]=5;b[2][2]=25;
> b[3][0]=7;b[3][1]=7;b[3][2]=49;
> for(i=8;i<10000;i++)
> {
> if(b[3][2]<b[2][2])
> {
> k=b[3][0];b[3][0]=b[2][0];b[2][0]=k;
> k=b[3][1];b[3][1]=b[2][1];b[2][1]=k;
> k=b[3][2];b[3][2]=b[2][2];b[2][2]=k;
> }
> if(b[2][2]<b[1][2])
> {
> k=b[2][0];b[2][0]=b[1][0];b[1][0]=k;
> k=b[2][1];b[2][1]=b[1][1];b[1][1]=k;
> k=b[2][2];b[2][2]=b[1][2];b[1][2]=k;
> }
> if(b[1][2]<b[0][2])
> {
> k=b[1][0];b[1][0]=b[0][0];b[0][0]=k;
> k=b[1][1];b[1][1]=b[0][1];b[0][1]=k;
> k=b[1][2];b[1][2]=b[0][2];b[0][2]=k;
> }
> a[i]=b[0][2];b[0][1]++;b[0][2]=b[0][0]*a[b[0][1]];
> if(a[i]==b[1][2])
> {
> b[1][1]++;b[1][2]=b[1][0]*a[b[1][1]];
> }
> if(a[i]==b[2][2])
> {
> b[2][1]++;b[2][2]=b[2][0]*a[b[2][1]];
> }
> if(a[i]==b[3][2])
> {
> b[3][1]++;b[3][2]=b[3][0]*a[b[3][1]];
> }
> }
> while(1)
> {
> cin>>j;
> if(j==0)
> break;
> qq[m++]=j;
> }
> for(int n=0;n<m+1;n++)
> {
> if((qq[n]/10)==0||(qq[n]/10)!=1)
> {
> switch(qq[n]%10){
> case 0:cout<<"The "<<qq[n]<<"th humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 1:cout<<"The "<<qq[n]<<"st humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 2:cout<<"The "<<qq[n]<<"nd humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 3:cout<<"The "<<qq[n]<<"rd humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 4:cout<<"The "<<qq[n]<<"th humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 5:cout<<"The "<<qq[n]<<"th humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 6:cout<<"The "<<qq[n]<<"th humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 7:cout<<"The "<<qq[n]<<"th humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 8:cout<<"The "<<qq[n]<<"th humble number is "<<a[qq[n]]<<"."<<endl;break;
> case 9:cout<<"The "<<qq[n]<<"th humble number is "<<a[qq[n]]<<"."<<endl;break;
> }
> }
> else
> {
> cout<<"The "<<qq[n]<<"th humble number is "<<a[qq[n]]<<"."<<endl;
> }
> }
> delete qq;
> }
有没有人回答我啊?
很急的啊
真的好像没有错误啊?
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator