Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. for (i = 0; i < N; ++i) {
  2. if (X[i] == Xb && Y[i] == Yb) {
  3. printf("N%u=Nb\n", i + 1);
  4. found_same = 1;
  5. continue;
  6. }
  7.  
  8. dist[i] = sqrt(pow(X[i] - Xb, 2) + pow(Y[i] - Yb, 2));
  9.  
  10. printf("N%u(%d;%d) is %.2lf from Nb(%d;%d)\n", i + 1, X[i], Y[i], dist[i], Xb, Yb);
  11.  
  12. if (!found_min || min > dist[i]) {
  13. found_min = 1;
  14. min = dist[i];
  15. min_i = i;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement