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.......求高手指教。。。。求给力!!!!!!

Posted by sjjwind at 2011-04-09 16:50:24 on Problem 2545
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>
#define N 10005
#define MAX 10e18
using namespace std;
__int64 arr[N];
int p1,p2,p3;
int main()
{
	int i,j,k;
	__int64 i1,i2,i3;
	__int64 sum,num,idx;
	while(cin>>p1>>p2>>p3>>num)
	{
		idx=0;
		i1=1;
		i2=1;
		i3=1;
		sum=0;
		for(i=1;sum<MAX;i++)
		{
			for(j=1;sum<MAX;j++)
			{
				for(k=1;sum<MAX;k++)
				{
					sum=i1*i2*i3;
					if(sum<MAX)
					{
						arr[idx]=sum;
						idx++;
					}
					i3*=p3;
				}
				i2*=p2;	
				i3=1;
				if(i2<MAX) sum=0;
			}	
			i1*=p1;
			i2=1;
			if(i1<MAX) sum=0;
		}
		sort(arr,arr+idx);
		cout<<arr[num]<<endl;
	//	system("pause");	
	}		
}



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