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:jxc2004 at 2005-08-29 16:41:16 #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