結果

問題 No.202 1円玉投げ
ユーザー 158b158b
提出日時 2015-05-04 00:19:09
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,004 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 58,388 KB
実行使用メモリ 8,588 KB
最終ジャッジ日時 2023-08-23 21:51:24
合計ジャッジ時間 13,079 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

using namespace std;

//重なったら1 そうでなければ0
int check(int loc1x, int loc1y, int loc2x, int loc2y){
	int kyori =  fabs( sqrt(pow(loc2x - loc1x, 2) + pow(loc2y - loc1y, 2) ) );
	
	//cout << "距離測定:" << loc1[0] << "," << loc1[0] << "と" << loc2[0] << "," << loc2[1] << ":" << kyori << endl;
	if(kyori < 20){
		return 1;
	}
	
	return 0;
}
	
int main(){
	int max;
	int loc[100000][2];
	int count = 0;
	
	
	cin >> max;
	for(int i=0; i<max; i++){
		cin >> loc[i][0];
		cin >> loc[i][1];
	}
	
	for(int i=0; i<max; i++){
		for(int i2=0; i2<i; i2++){
			if(loc[i][0] != -1 && loc[i2][0] != -1){
				if(check(loc[i][0], loc[i][1], loc[i2][0], loc[i2][1]) == 1){
					loc[i][0] = -1;
					break;
				}
			}
		}
		
		if(loc[i][0] != -1){
			count ++;
		}
	}
	
	//中身確認
	/*
	for(int i=0; i<max; i++){
		cout << loc[i][0] << "," << loc[i][1] << endl;
	}
	*/
	cout << count << endl;
	
}

0