結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
TLwiegehtt
|
| 提出日時 | 2015-07-21 05:10:17 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 742 ms / 5,000 ms |
| コード長 | 1,378 bytes |
| コンパイル時間 | 1,277 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 45,040 KB |
| 最終ジャッジ日時 | 2024-12-22 09:41:40 |
| 合計ジャッジ時間 | 8,874 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
main.c:21:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%d %d", &nx, &ny);
| ^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#define CMAX (100000)
#define WMAX (32)
#define HMAX (32)
int field[HMAX+2][WMAX+2][10000];
int fCnt[HMAX+2][WMAX+2];
int coin[CMAX+2];
int main(void){
int i,j,k,n;
int cCnt=0;
scanf("%d", &n);
for(i=0;i<n;i++){
int nx, ny;
scanf("%d %d", &nx, &ny);
coin[i] = nx*100000+ny;
}
for(i=0;i<n;i++){
int noHit=1;
int nx, ny;
int px, py;
nx = coin[i] / 100000;
ny = coin[i] % 100000;
px = nx/(20000/WMAX);
py = ny/(20000/HMAX);
// printf("for i %d %d %d %d %d\n", i, nx, ny, px, py);
// printf("for ii px=%d/(20000/%d) , py=%d/(20000/%d)\n", nx,WMAX, ny, HMAX);
for(j=-1;j<=1;j++){
for(k=-1;k<=1;k++){
int s;
int fx = px+k;
int fy = py+j;
if(fx < 0 || WMAX < fx){continue;}
if(fy < 0 || HMAX < fy){continue;}
// printf("ff %d %d %d %d %d\n", nx, ny, fx, fy, fCnt[fy][fx]);
for(s=0;s<fCnt[fy][fx];s++){
int tx = field[fy][fx][s] / 100000;
int ty = field[fy][fx][s] % 100000;
int len = (nx-tx)*(nx-tx)+(ny-ty)*(ny-ty);
if( len < 20*20){
noHit = 0;
j=k=10;
break;
}
}
}
}
if(noHit == 1){
field[py][px][fCnt[py][px]] = nx*100000+ny;
fCnt[py][px] += 1;
cCnt += 1;
// printf("Add px[%d], py[%d], fCnt[py][px]=[%d]\n", px, py, fCnt[py][px]);
}
}
printf("%d\n", cCnt);
return 0;
}
TLwiegehtt