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 |
那么大的数组当然要全局的In Reply To:Re:帮忙改一下 Posted by:flyingfish at 2005-08-29 17:02:45 > #include<iostream> > using namespace std; > int num[10000000]; > int main() > { > int i,two,three,t1,t2,n; > two=three=0; > num[0]=1; > for(i=1;i<10000000;i++) > { > t1=2*num[two]+1; > t2=3*num[three]+1; > if(t1<t2) > { > num[i]=t1; > two++; > } > else if(t1>t2) > { > num[i]=t2; > three++; > } > else > { > num[i]=t1; > three++; > two++; > } > } > while(cin>>n) > cout<<num[n-1]<<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