Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

WA ,,why>>??

Posted by fflyn258 at 2006-07-13 02:08:01 on Problem 2545
#include <iostream>
using namespace std;
void init();
__int64 min(__int64 , __int64 , __int64 );
int a,b,c;
__int64 num[1500];
int main()
{
	int i;
	cin>>a>>b>>c>>i;
	init();
	printf("%I64d\n",num[i+1]);
	return 0;
}
void init()
{
	int p1,p2,p3;
	p1=p2=p3=1;
	num[1]=1;
	int p=1;
	while(num[p]<10e17){
		p++;
		num[p]=min(num[p1]*a,num[p2]*b,num[p3]*c);
		while(num[p1]*a<=num[p]) p1++;
		while(num[p2]*b<=num[p]) p2++;
		while(num[p3]*c<=num[p]) p3++;
	}
}
__int64 min(__int64 i,__int64 j,__int64 l)
{
	__int64 k=i<j?i:j;
	return k<l?k:l;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator