这个题 感觉数据是500 就直接三层循环上去了。 。但是超时了。 我用了最简单的方法 可能是运算量略大的原因吧。(好吧。 在自己稍微优化之后A了。 跑了2.059秒,代码在最后面)
在不会优化的情况下。 去网上搜了题解。
第一份代码。 在我看明白之后 不得不佩服 原作者的聪明机智。 也算是 学到了。
先上代码后讲解。
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <cctype>
using namespace std;
#define ll long long
typedef unsigned long long ull;
#define maxn 1001
#define INF 1<<30
double p = acos(-1);
struct po{
double x,y;
} s[maxn];
int main (){
int n;
double r;
while(scanf("%d%lf",&n,&r) != EOF && n && r) {
double f[maxn];
for(int i = 0; i < n; i++