| ||||||||||
| 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 "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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator