#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class stu
{
public:
int x;
int y;
float slope;
};
int main()
{
int s;
cin>>s;
int n=s+1;
stu* stud = new stu[n*n];
int k =0;
for(int i = 0;i < n;i++)
{
for(int j = 0;j < n;j++)
{
stud[k+j].x =((k+i)/n);
stud[k+j].y = j;
}
k=k+n;
}
vector<float>v;
for(int k=0;k<n*n;k++)
{
if(stud[k].x != 0)
{
stud[k].slope = (float)stud[k].y/stud[k].x;
v.push_back(stud[k].slope);
}
}
sort(v.begin(),v.end());
v.erase(unique(v.begin(), v.end()), v.end());
cout << v.size()+1 <<endl;
delete [] stud;
return 0;
}
来源:https://www.cnblogs.com/mini-coconut/p/8640405.html