Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Hae-Dal
python
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
python
/
back_joon.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
58 lines (49 loc) · 1.61 KB
master
Breadcrumbs
python
/
back_joon.py
Copy path
Top
File metadata and controls
Code
Blame
58 lines (49 loc) · 1.61 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def centers_distance(numbers: list):
x1 = numbers[0]
y1 = numbers[1]
x2 = numbers[3]
y2 = numbers[4]
return ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5
test_num = int(input())
test_cases = []
answer = []
'''
1. 입력은 어떻게 들어오지?
2. 어떻게 입력 받지?
'''
for i in range(test_num):
numbers = input().split()
numbers_list = [int(num) for num in numbers]
test_cases.append(numbers_list)
# 입력 완료 =======================================
for tc in test_cases:
'''
1. 어떻게 출력 값이 나올까? -> 문제를 해결하기 위해 어떻게 접근해야할까?
2. 두 터렛에서 계산한 길이를 반지름으로한 두 원의 교점을 확인해보자!
3. 류재명이 있을 수 있는 좌표의 수는 두 원의 교점의 수이다. 따라서 좌표의 수는 -1,0,1,2 뿐이다.
4. if문으로 분기별 답을 추가한 후 마지막에 출력하자
'''
d = centers_distance(tc)
x1 = tc[0]
y1 = tc[1]
x2 = tc[3]
y2 = tc[4]
r1 = tc[2]
r2 = tc[5]
if d == 0.0:
if r1 == r2:
answer.append(-1)
else:
answer.append(0)
else:
# 두 원의 원점이 다를 때
if d == r1 + r2 or d == abs(r1 - r2):
# 두 원의 교점이 1개일 때
answer.append(1)
elif r1 + r2 > d > abs(r1 - r2):
# 두 원의 교점이 2개일 때
answer.append(2)
else :
# 두 원의 교점이 0개일 때
answer.append(0)
[print(n) for n in answer]
You can’t perform that action at this time.