struct circle
{
double x, y;
bool operator < (const circle& b) const
{
if (fabs(x-b.x) >= eps)
return x < b.x;
return fabs(y-b.y) >= eps && y < b.y;
}
};
circle circle[1000010];
int x[110], y[110];
long long C[120] = {0,0,0,0,0,0,0,1,8,36,120,330,792,1716,3432,6435,11440,19448,31824,50388,
77520,116280,170544,245157,346104,480700,657800,888030,1184040,1560780,2035800,
2629575,3365856,4272048,5379616,6724520,8347680,10295472,12620256,15380937,18643560,
22481940,26978328,32224114,38320568,45379620,53524680,62891499,73629072,85900584,
99884400,115775100,133784560,154143080,177100560,202927725,231917400,264385836,
300674088,341149446,386206920,436270780,491796152,553270671,621216192,696190560,
778789440,869648208,969443904,1078897248,1198774720,1329890705,1473109704,1629348612,
1799579064,1984829850,2186189400,2404808340,2641902120,2898753715,3176716400,3477216600,
3801756816,4151918628,4529365776,4935847320,5373200880,5843355957,6348337336,6890268572,
7471375560,8093990190,8760554088,9473622444,10235867928,11050084695,11919192480,
12846240784,13834413152,14887031544,16007560800,17199613200,18466953120,19813501785,
21243342120,22760723700,24370067800,26075972546,27883218168,29796772356};
int main()
{
int T;
cin >> T;
for (int kase = 1; kase <= T; ++kase)
{
int n;
cin >> n;
for (int i = 0; i < n; ++i)
scanf(“%d%d”, &x[i], &y[i]);
int cnt = 0;
for (int i = 0; i < n-2; ++i)
for (int j = i+1; j < n-1; ++j)
for (int k = j+1; k < n; ++k)
if ((x[i]-x[j])(y[j]-y[k]) != (x[j]-x[k])(y[i]-y[j]))
{
circle[cnt].x = ((x[i]x[i]+y[i]y[i]-x[j]x[j]-y[j]y[j])(y[j]-y[k])-(x[j]x[j]+y[j]y[j]-x[k]x[k]-y[k]y[k])(y[i]-y[j]))1.0/(2.0((x[i]-x[j])(y[j]-y[k])-(x[j]-x[k])(y[i]-y[j])));
if (y[i] != y[j])
circle[cnt].y = (x[i]x[i]+y[i]y[i]-x[j]x[j]-y[j]y[j]-(2x[i]-2x[j])circle[cnt].x)/(2.0y[i]-2.0y[j]);
else
circle[cnt].y = (x[j]x[j]+y[j]y[j]-x[k]x[k]-y[k]y[k]-(2x[j]-2x[k])circle[cnt].x)/(2.0y[j]-2.0y[k]);
cnt++;
}
sort(circle, circle+cnt);
long long sum = 0, temp = 1;
for (int i = 1; i < cnt; ++i)
{
//printf(“(%f, %f)\n”, circle[i].x, circle[i].y);
if (fabs(circle[i].x-circle[i-1].x) < eps && fabs(circle[i].y-circle[i-1].y) < eps)
temp++;
else
{
if (temp >= 35)
{
long long t;
for (t = 7; t < 110; ++t)
if (t(t-1)(t-2) == 6temp)
break;
sum += C[t];
}
temp = 1;
}
}
if (temp >= 35)
{
long long t;
for (t = 7; t < 110; ++t)
if (t(t-1)(t-2) == 6temp)
break;
sum += C[t];
}
printf(“Case #%d:%I64d\n”, kase, sum);
}
return 0;
}
/*#include
include
include
include
include
using namespace std;
struct circle
{
double x, y;
bool operator < (const circle& b) const
{
if (fabs(x-b.x) < 1e-8)
return (fabs(y-b.y) < 1e-8) || y < b.y;
return x < b.x;
}
};
circle circle[1000010];
int x[110], y[110];
long long C[120] = {0,0,0,0,0,0,0,1,8,36,120,330,792,1716,3432,6435,11440,19448,31824,50388,
77520,116280,170544,245157,346104,480700,657800,888030,1184040,1560780,2035800,
2629575,3365856,4272048,5379616,6724520,8347680,10295472,12620256,15380937,18643560,
22481940,26978328,32224114,38320568,45379620,53524680,62891499,73629072,85900584,
99884400,115775100,133784560,154143080,177100560,202927725,231917400,264385836,
300674088,341149446,386206920,436270780,491796152,553270671,621216192,696190560,
778789440,869648208,969443904,1078897248,1198774720,1329890705,1473109704,1629348612,
1799579064,1984829850,2186189400,2404808340,2641902120,2898753715,3176716400,3477216600,
3801756816,4151918628,4529365776,4935847320,5373200880,5843355957,6348337336,6890268572,
7471375560,8093990190,8760554088,9473622444,10235867928,11050084695,11919192480,
12846240784,13834413152,14887031544,16007560800,17199613200,18466953120,19813501785,
21243342120,22760723700,24370067800,26075972546,27883218168,29796772356};
int main()
{
for (int i = 3; i < 110; ++i)
mp[cc[i]] = i;
int T;
cin >> T;
for (int kase = 1; kase <= T; ++kase)
{
int n;
cin >> n;
for (int i = 0; i < n; ++i)
scanf(“%d%d”, &x[i], &y[i]);
int cnt = 0;
for (int i = 0; i < n-2; ++i)
for (int j = i+1; j < n-1; ++j)
for (int k = j+1; k < n; ++k)
if ((x[i]-x[j])(y[j]-y[k]) != (x[j]-x[k])(y[i]-y[j]))
{
circle[cnt].x = ((x[i]x[i]+y[i]y[i]-x[j]x[j]-y[j]y[j])(y[j]-y[k])-(x[j]x[j]+y[j]y[j]-x[k]x[k]-y[k]y[k])(y[i]-y[j]))1.0/(2.0((x[i]-x[j])(y[j]-y[k])-(x[j]-x[k])(y[i]-y[j])));
if (y[i] != y[j])
circle[cnt].y = (x[i]x[i]+y[i]y[i]-x[j]x[j]-y[j]y[j]-(2x[i]-2x[j])circle[cnt].x)/(2.0y[i]-2.0y[j]);
else
circle[cnt].y = (x[j]x[j]+y[j]y[j]-x[k]x[k]-y[k]y[k]-(2x[j]-2x[k])circle[cnt].x)/(2.0y[j]-2.0y[k]);
cnt++;
}
sort(circle, circle+cnt);
long long sum = 0, temp = 1;
for (int i = 1; i < cnt; ++i)
{
//printf(“(%f, %f)\n”, circle[i].x, circle[i].y);
if (fabs(circle[i].x-circle[i-1].x) < 1e-8 && fabs(circle[i].y-circle[i-1].y) < 1e-8)
temp++;
else
{
if (temp >= 35)
sum += C[mp[temp]];
temp = 1;
}
}
if (temp >= 35)
sum += C[mp[temp]];
无限WA,哪里错了???
include
include
include
include
using namespace std;
define eps 1e-8
struct circle
{
double x, y;
bool operator < (const circle& b) const
{
if (fabs(x-b.x) >= eps)
return x < b.x;
return fabs(y-b.y) >= eps && y < b.y;
}
};
circle circle[1000010];
int x[110], y[110];
long long C[120] = {0,0,0,0,0,0,0,1,8,36,120,330,792,1716,3432,6435,11440,19448,31824,50388,
77520,116280,170544,245157,346104,480700,657800,888030,1184040,1560780,2035800,
2629575,3365856,4272048,5379616,6724520,8347680,10295472,12620256,15380937,18643560,
22481940,26978328,32224114,38320568,45379620,53524680,62891499,73629072,85900584,
99884400,115775100,133784560,154143080,177100560,202927725,231917400,264385836,
300674088,341149446,386206920,436270780,491796152,553270671,621216192,696190560,
778789440,869648208,969443904,1078897248,1198774720,1329890705,1473109704,1629348612,
1799579064,1984829850,2186189400,2404808340,2641902120,2898753715,3176716400,3477216600,
3801756816,4151918628,4529365776,4935847320,5373200880,5843355957,6348337336,6890268572,
7471375560,8093990190,8760554088,9473622444,10235867928,11050084695,11919192480,
12846240784,13834413152,14887031544,16007560800,17199613200,18466953120,19813501785,
21243342120,22760723700,24370067800,26075972546,27883218168,29796772356};
int main()
{
int T;
cin >> T;
for (int kase = 1; kase <= T; ++kase)
{
int n;
cin >> n;
for (int i = 0; i < n; ++i)
scanf(“%d%d”, &x[i], &y[i]);
int cnt = 0;
for (int i = 0; i < n-2; ++i)
for (int j = i+1; j < n-1; ++j)
for (int k = j+1; k < n; ++k)
if ((x[i]-x[j])(y[j]-y[k]) != (x[j]-x[k])(y[i]-y[j]))
{
circle[cnt].x = ((x[i]x[i]+y[i]y[i]-x[j]x[j]-y[j]y[j])(y[j]-y[k])-(x[j]x[j]+y[j]y[j]-x[k]x[k]-y[k]y[k])(y[i]-y[j]))1.0/(2.0((x[i]-x[j])(y[j]-y[k])-(x[j]-x[k])(y[i]-y[j])));
if (y[i] != y[j])
circle[cnt].y = (x[i]x[i]+y[i]y[i]-x[j]x[j]-y[j]y[j]-(2x[i]-2x[j])circle[cnt].x)/(2.0y[i]-2.0y[j]);
else
circle[cnt].y = (x[j]x[j]+y[j]y[j]-x[k]x[k]-y[k]y[k]-(2x[j]-2x[k])circle[cnt].x)/(2.0y[j]-2.0y[k]);
cnt++;
}
sort(circle, circle+cnt);
long long sum = 0, temp = 1;
for (int i = 1; i < cnt; ++i)
{
//printf(“(%f, %f)\n”, circle[i].x, circle[i].y);
if (fabs(circle[i].x-circle[i-1].x) < eps && fabs(circle[i].y-circle[i-1].y) < eps)
temp++;
else
{
if (temp >= 35)
{
long long t;
for (t = 7; t < 110; ++t)
if (t(t-1)(t-2) == 6temp)
break;
sum += C[t];
}
temp = 1;
}
}
if (temp >= 35)
{
long long t;
for (t = 7; t < 110; ++t)
if (t(t-1)(t-2) == 6temp)
break;
sum += C[t];
}
printf(“Case #%d:%I64d\n”, kase, sum);
}
return 0;
}
/*#include
include
include
include
include
using namespace std;
struct circle
{
double x, y;
bool operator < (const circle& b) const
{
if (fabs(x-b.x) < 1e-8)
return (fabs(y-b.y) < 1e-8) || y < b.y;
return x < b.x;
}
};
circle circle[1000010];
int x[110], y[110];
long long C[120] = {0,0,0,0,0,0,0,1,8,36,120,330,792,1716,3432,6435,11440,19448,31824,50388,
77520,116280,170544,245157,346104,480700,657800,888030,1184040,1560780,2035800,
2629575,3365856,4272048,5379616,6724520,8347680,10295472,12620256,15380937,18643560,
22481940,26978328,32224114,38320568,45379620,53524680,62891499,73629072,85900584,
99884400,115775100,133784560,154143080,177100560,202927725,231917400,264385836,
300674088,341149446,386206920,436270780,491796152,553270671,621216192,696190560,
778789440,869648208,969443904,1078897248,1198774720,1329890705,1473109704,1629348612,
1799579064,1984829850,2186189400,2404808340,2641902120,2898753715,3176716400,3477216600,
3801756816,4151918628,4529365776,4935847320,5373200880,5843355957,6348337336,6890268572,
7471375560,8093990190,8760554088,9473622444,10235867928,11050084695,11919192480,
12846240784,13834413152,14887031544,16007560800,17199613200,18466953120,19813501785,
21243342120,22760723700,24370067800,26075972546,27883218168,29796772356};
int cc[120] = {0,0,0,1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816,969,1140,
1330,1540,1771,2024,2300,2600,2925,3276,3654,4060,4495,4960,5456,5984,6545,7140,7770,
8436,9139,9880,10660,11480,12341,13244,14190,15180,16215,17296,18424,19600,20825,22100,
23426,24804,26235,27720,29260,30856,32509,34220,35990,37820,39711,41664,43680,45760,
47905,50116,52394,54740,57155,59640,62196,64824,67525,70300,73150,76076,79079,82160,
85320,88560,91881,95284,98770,102340,105995,109736,113564,117480,121485,125580,129766,
134044,138415,142880,147440,152096,156849,161700,166650,171700,176851,182104,187460,192920,
198485,204156,209934};
map mp;
int main()
{
for (int i = 3; i < 110; ++i)
mp[cc[i]] = i;
int T;
cin >> T;
for (int kase = 1; kase <= T; ++kase)
{
int n;
cin >> n;
for (int i = 0; i < n; ++i)
scanf(“%d%d”, &x[i], &y[i]);
int cnt = 0;
for (int i = 0; i < n-2; ++i)
for (int j = i+1; j < n-1; ++j)
for (int k = j+1; k < n; ++k)
if ((x[i]-x[j])(y[j]-y[k]) != (x[j]-x[k])(y[i]-y[j]))
{
circle[cnt].x = ((x[i]x[i]+y[i]y[i]-x[j]x[j]-y[j]y[j])(y[j]-y[k])-(x[j]x[j]+y[j]y[j]-x[k]x[k]-y[k]y[k])(y[i]-y[j]))1.0/(2.0((x[i]-x[j])(y[j]-y[k])-(x[j]-x[k])(y[i]-y[j])));
if (y[i] != y[j])
circle[cnt].y = (x[i]x[i]+y[i]y[i]-x[j]x[j]-y[j]y[j]-(2x[i]-2x[j])circle[cnt].x)/(2.0y[i]-2.0y[j]);
else
circle[cnt].y = (x[j]x[j]+y[j]y[j]-x[k]x[k]-y[k]y[k]-(2x[j]-2x[k])circle[cnt].x)/(2.0y[j]-2.0y[k]);
cnt++;
}
sort(circle, circle+cnt);
long long sum = 0, temp = 1;
for (int i = 1; i < cnt; ++i)
{
//printf(“(%f, %f)\n”, circle[i].x, circle[i].y);
if (fabs(circle[i].x-circle[i-1].x) < 1e-8 && fabs(circle[i].y-circle[i-1].y) < 1e-8)
temp++;
else
{
if (temp >= 35)
sum += C[mp[temp]];
temp = 1;
}
}
if (temp >= 35)
sum += C[mp[temp]];
}*/