結果

問題 No.202 1円玉投げ
ユーザー TLwiegehtt
提出日時 2015-07-20 04:17:17
言語 C90
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 557 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-22 09:45:47
合計ジャッジ時間 71,853 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 7 WA * 23 TLE * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:23:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |                 scanf("%d %d", &tx, &ty);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

#define	CMAX	(100000)


typedef struct{
	int x;
	int y;
}POINT;


POINT coin[CMAX+5];

int main(void){
	int i,j,n;
	int cCnt=0;
	
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		int noHit=1;
		int tx, ty;
		scanf("%d %d", &tx, &ty);
		
		for(j=0;j<cCnt;j++){
			int len = (tx-coin[j].x)*(tx-coin[j].x) + (ty-coin[j].y)*(ty-coin[j].y);
			
			if(len < 20*20){
				printf("Hit %d %d\n",i, j);
				noHit = 0;
				break;
			}
		}
		if(noHit==1){
			coin[cCnt].x = tx;
			coin[cCnt].y = ty;
			cCnt += 1;
		}
	}
	
	printf("%d\n", cCnt);
	return 0;
}
0