250:I solve this as practice of C++. Now, I study C++. I spend a lot of time to compile and testing, however, solve at the score is 191.66.
500:I think using BFS, however, it's not good. I spent time to think, and I can't solve. After the contest, I see rng_58's source and chokudai's source. It's very simple!
Result:191.66,436/996.
<250>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
class MagicalGirlLevelOneDivTwo{
public:
double theMinDistance(int d, int x, int y);
};
double MagicalGirlLevelOneDivTwo::theMinDistance(int d, int x, int y){
x=abs(x);
y=abs(y);
x-=d;
y-=d;
if(x<=0) x=0;
if(y<=0) y=0;
double r;
r=sqrt((double)x*x+(double)y*y);
return r;
}
0 件のコメント:
コメントを投稿