Submission #741679

# Submission time Handle Problem Language Result Execution time Memory
741679 2023-05-14T14:18:56 Z jongjip Intercastellar (JOI22_ho_t1) C
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main() {
  int n, m;
  scanf("%d %d", &n, &m);

  int x[n], y[n];
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x[i], &y[i]);
  }

  int dx = x[n - 1] - x[0];
  int dy = y[n - 1] - y[0];

  int d = sqrt(dx * dx + dy * dy);

  int ans = 0;
  for (int i = 0; i < n; i++) {
    int nx = x[i] + m * dx;
    int ny = y[i] + m * dy;

    int dist = sqrt((nx - x[0]) * (nx - x[0]) + (ny - y[0]) * (ny - y[0]));

    if (dist <= d) {
      ans++;
    }
  }

  printf("%d\n", ans);
}

Compilation message

Main.c: In function 'main':
Main.c:7:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |   scanf("%d %d", &n, &m);
      |   ^~~~~~~~~~~~~~~~~~~~~~
Main.c:11:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d %d", &x[i], &y[i]);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/cchh2kTY.o: in function `main':
Main.c:(.text.startup+0x22c): undefined reference to `sqrt'
/usr/bin/ld: Main.c:(.text.startup+0x240): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status