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 |
各种WA.......求高手指教。。。。求给力!!!!!!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator