結果

問題 No.202 1円玉投げ
ユーザー kentahama
提出日時 2015-05-04 00:15:03
言語 C90
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 542 bytes
コンパイル時間 1,291 ms
コンパイル使用メモリ 22,912 KB
実行使用メモリ 8,868 KB
最終ジャッジ日時 2024-12-22 06:59:33
合計ジャッジ時間 133,087 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 TLE * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:20:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |   scanf("%d", &N);
      |   ^~~~~~~~~~~~~~~
main.c:25:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |     scanf("%d %d", &buf.x, &buf.y);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>

typedef struct point {
  int x;
  int y;
} point_t;

point_t p[100000];
int pnum;

int N;
int count;

int collision(point_t p, point_t q) {
  return hypot(p.x - q.x, p.y - q.y) < 20;
}

int main(void) {
  scanf("%d", &N);
  int i, j;

  for (i = 0; i < N; i++) {
    point_t buf;
    scanf("%d %d", &buf.x, &buf.y);
    for (j = 0; j < pnum; j++) {
      if (collision(buf, p[j])) {
        break;
      }
    }
    if (j == pnum) {
      p[pnum++] = buf;
    }
  }
  printf("%d\n", pnum);
  return 0;
}
0