1 条题解
-
0
#include<bits/stdc++.h> using namespace std; int q[1000011]; int main(){ freopen("blah.in","r",stdin); freopen("blah.out","w",stdout); int a,n,x,two,three,rear; cin>>a>>n; two=three=rear=1; q[1]=a; while(rear!=n){ if(2*q[two]+1>3*q[three]+1){ rear++; q[rear]=3*q[three]+1; three++; } else if(2*q[two]+1<3*q[three]+1){ rear++; q[rear]=2*q[two]+1; two++; } else{ rear++; q[rear]=3*q[three]+1; three++; two++; } } cout<<q[n]<<endl; return 0; }
- 1
信息
- ID
- 11
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 10
- 标签
- (无)
- 递交数
- 8
- 已通过
- 2
- 上传者