Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #define task ""
- using namespace std;
- using ll = long long;
- using ld = long double;
- const int N = 50 + 2;
- int n;
- struct Point
- {
- ll x, y;
- Point operator-(const Point &a)
- {
- Point ans;
- ans.x = x - a.x;
- ans.y = y - a.y;
- return ans;
- }
- ll operator*(const Point &a)
- {
- return x * a.y - y * a.x;
- }
- } a[N];
- void Read()
- {
- for (int i = 1; i <= n; ++i)
- cin >> a[i].x >> a[i].y;
- }
- ll Online(int i, int j, int t)
- {
- return (a[i] - a[j]) * (a[i] - a[t]) == 0ll;
- }
- void Solve()
- {
- if (n < 4)
- {
- cout << "0\n";
- return;
- }
- ll ans = 0;
- for (int i = 1; i <= n; ++i)
- for (int j = i + 1; j <= n; ++j)
- for (int t = j + 1; t <= n; ++t)
- for (int h = t + 1; h <= n; ++h)
- if (!Online(i, j, t) && !Online(i, t, h) && !Online(j, t, h) && !Online(i, j, h))
- ++ans;
- cout << ans << "\n";
- }
- int32_t main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- if (fopen(task ".INP", "r"))
- {
- freopen(task ".INP", "r", stdin);
- freopen(task ".OUT", "w", stdout);
- }
- while (cin >> n)
- {
- if (n == 0)
- break;
- Read();
- Solve();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment