答案:很简单67108864
答案:3181
答案:40257
代码示例如下:
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
const int N= 200000;
int n;
struct Line{
double k,b;
bool operator<(const Line& t) const
{
if(k != t.k) return k<t.k;
return b< t.b;
}
}l[N];
int main()
{
for (int x1=0;x1<20;x1++)
for (int y1=0;y1<21;y1++)
for(int x2=0;x2<20;x2++)
for(int y2=0;y2<21;y2++)
if(x1 != x2)
{
double k=(double)(y2-y1)/(x2-x1);
double b= y1-k *x1;
l[n ++ ]={k,b};
}
sort(1,1+n);//排序,应该是升序
int res=1;
for(int i=1;i<n;i++)
if(fabs(l[i].k-l[i-1].k) > 1e-8||fabs(l[i].b-l[i-1].b) > 1e-8)//已实现排序,故可以这样消除同k同b的直线
res++;
cout<<res+20<<endl;
return 0;
}