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 |
我的C :-)#include <stdio.h> void main() { __int64 p1,p2,p3,num,counter,i,min; __int64 display[10010]={0}; scanf("%I64d%I64d%I64d%I64d",&p1,&p2,&p3,&num); if(p1>p2){ i=p1;p1=p2;p2=i; } if(p3<p1){ i=p3;p3=p2;p2=p1;p1=i; } else if(p3<p2){ i=p2;p2=p3;p3=i; } display[0]=1; display[1]=p1; counter=2; while(counter<=num){ for(i=counter-1;display[i]*p1>display[counter-1]&&i>=0;i--); min=display[i+1]*p1; for(i=counter-1;display[i]*p2>display[counter-1]&&i>=0;i--); if(display[i+1]*p2<min)min=display[i+1]*p2; for(i=counter-1;display[i]*p3>display[counter-1]&&i>=0;i--); if(display[i+1]*p3<min)min=display[i+1]*p3; display[counter]=min; counter++; } printf("%I64d\n",display[num]); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator