又是这种题..POJ上这种题真多
![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
#include <stdio.h>
__int64 ar[10000000];
__int64 min(__int64 a,__int64 b,__int64 c)
{
if(a<=b&&a<=c)return a;
if(b<=a&&b<=c)return b;
if(c<=a&&c<=b)return c;
}
int main()
{
int a,b,c,n,i,j,k,l;
while (scanf("%d%d%d%d",&a,&b,&c,&n)!=EOF)
{
i=j=k=0;
ar[0]=1;
for (l=1;l<=n;l++)
{
ar[l]=min(ar[i]*a,ar[j]*b,ar[k]*c);
if(ar[i]*a==ar[l])i++;
if(ar[j]*b==ar[l])j++;
if(ar[k]*c==ar[l])k++;
}
printf("%lld\n",ar[n]);
}
return 0;
}