poj2591
来源:互联网 发布:mac能玩跑跑卡丁车吗 编辑:程序博客网 时间:2024/05/22 03:13
#include
using namespace std;
long a[10000001]={0,1};
int main(){
int x2=1,x3=1,n;
for(int i=2;i<=10000000;i++)
{
a[i]=min(2*a[x2]+1,3*a[x3]+1);
if(a[i]==2*a[x2]+1) x2++;
if(a[i]==3*a[x3]+1) x3++;
}
while(cin>>n&&n>=1&&n<=10000000)cout<<a[n]<<endl;
return 0;
}
0 0
- POJ2591
- poj2591
- POJ2591
- poj1338 poj2591 poj2545 这三道题
- poj1338--poj2545--poj2591--打表
- poj2591 Set Definition(递推)
- 多式子递推poj2545 poj2591 poj1338
- 转一篇好文:poj1338 poj2591 poj2545 这三道题
- POJ1338 & POJ2545 & POJ2591 & POJ2247 找给定规律的数
- poj2562
- poj2575
- Uva 673 Parentheses Balance
- poj2578
- poj2579
- poj2591
- poj2606
- poj2608
- poj1061
- poj2636
- poj2656
- poj2664
- poj2665
- poj2780