Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- let intersection = (C1, C2) => {
- let distance = (C1.x - C2.x)**2 + (C1.y - C2.y)**2
- return distance <= (C1.rayon + C2.rayon)**2
- }
- const n = parseInt(readline());
- let circles = []
- for (let i = 0; i < n; i++) {
- var inputs = readline().split(' ');
- const x = parseFloat(inputs[0]);
- const y = parseFloat(inputs[1]);
- circles.push({x, y, rayon: 0})
- }
- let count = 0
- while(1) {
- let c = 0
- for(let i = 0; i < circles.length; i++) {
- for(let j = 0; j < circles.length; j++){
- if(i != j) {
- if(intersection(circles[i], circles[j])) {
- print(count)
- c++
- }
- }
- }
- }
- for(let i = 0; i < circles.length; i++) {
- circles[i].rayon++
- }
- count++
- }
- // Write an answer using console.log()
- // To debug: console.error('Debug messages...');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement