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 |
帮忙改一下#include<iostream> using namespace std; int main() { long num[10000000],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