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 ArXoR at 2005-01-10 14:25:47 on Problem 1406
#include "stdio.h"
#include "math.h"

int main(){
	long it;
	int i,j,max,offer,temp;
	for(scanf("%d",&offer);offer!=0;scanf("%d",&offer),max=0){
		for (i=0;(it=i*i*i)<=offer;i++){
			for (j=(int)pow(6*(offer-it),1/3.0)+2;(temp=it+j*(j+1)*(j+2)/6)>offer;j--);
			max=temp>max?temp:max;
		}
		printf("%d\n",max);
	}
	return 0;
}

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