結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
TLwiegehtt
|
| 提出日時 | 2015-07-21 03:29:59 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,131 bytes |
| コンパイル時間 | 1,162 ms |
| コンパイル使用メモリ | 21,760 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2024-12-22 09:41:04 |
| 合計ジャッジ時間 | 4,434 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 21 |
コンパイルメッセージ
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);
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-1) < fx){continue;}
if(fy < 0 || (HMAX-1) < fy){continue;}
for(s=0;s<fCnt[fy][fx];s++){
int tx = field[fy][fx][k] / 100000;
int ty = field[fy][fx][k] % 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;
// printf("%d add %d\n", i, nx*100000+ny);
fCnt[py][px] += 1;
cCnt += 1;
}
}
printf("%d\n", cCnt);
return 0;
}
TLwiegehtt