Cod sursa(job #1312551)

Utilizator kappykkDragos kappykk Data 9 ianuarie 2015 18:10:27
Problema Pachete Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.9 kb
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define x first
#define y second

using namespace std;

int dx[] = {- 1 , 0 , 1 , 0};
int dy[] = {0 , 1 , 0 , -1};

vector<pii> x;
vector<double> rez;

double panta(pii a , pii b){
    return ((b.y - a.y) / (b.x - a.x));
}

int main()
{
    ifstream f("pachete.in");
    ofstream g("pachete.out");
    int n;
    f>>n;
    pii s;
    f>>s.x;
    f>>s.y;
    for(int i = 1 ; i <= n ; ++i){
        int a, b;
        f>>a;
        f>>b;
        x.pb(mp(a,b));
    }
    for(int i = 0 ; i < x.size() ; ++i){
        rez.pb(panta(x[i] , s));
    }
    sort(rez.begin() , rez.end());
    int k = 0;
    for(int i = 0 ; i < x.size() - 1 ; ++i){
        if(x[i] != x[i + 1]){
            ++k;
        }
    }
    g<<k;
    return 0;
}