Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. struct stars
  4. {
  5. int x,y,pos;
  6. };
  7. int main()
  8. {
  9. int n,i=0;
  10. stars temp,star[100000];
  11. cin>>n;
  12. while(n--){
  13. cin>>star[i].x>>star[i].y;
  14. star[i].pos=i;
  15. i++;
  16. }
  17. n=i;
  18. for(int i=2;i<n;i++)
  19. for(int j=i+1;j<n;j++)
  20. {
  21. if((star[i].x>star[j].x)||((star[i].x==star[j].x)&&(star[i].y>star[j].y)))
  22. {
  23. temp=star[i];
  24. star[i]=star[j];
  25. star[j]=temp;
  26. }
  27. }
  28. for(i=2;i<n;i++)
  29. {
  30. if((star[0].x*(star[1].y-star[i].y) + star[1].x*(star[i].y-star[0].y) + star[i].x*(star[0].y-star[1].y)) != 0) break;
  31. }
  32. printf("%d %d %d\n",1+star[0].pos,1+star[1].pos,star[i].pos+1);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement