Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 백준
- Text
- C
- php
- 사칙연산
- MySQL
- Incognito
- Database
- 문자열
- Web
- 써니나타스
- CTF
- 인코그니토
- Network
- Forensics
- 그리디 알고리즘
- HackCTF
- misc
- writeup
- wargame
- xcz.kr
- Web Hacking
- Python
- 구현
- cryptography
- 정렬
- N0Named
- Digital Forensics
- SuNiNaTas
- 수학
Archives
- Today
- Total
보안을 그리다, 훈이
[Baekjoon/Python3] 3036번 링 본문
[Baekjoon/Python3] 3036번 링
3036번: 링
출력은 총 N-1줄을 해야 한다. 첫 번째 링을 제외한 각각의 링에 대해서, 첫 번째 링을 한 바퀴 돌리면 그 링은 몇 바퀴 도는지 기약 분수 형태 A/B로 출력한다.
www.acmicpc.net
# 2Πr
def gcd(a, b):
if b % a:
return gcd(b % a, a)
else:
return a
n = int(input())
rs = list(map(int, input().split()))
for i in range(1, n):
g = gcd(rs[0], rs[i])
print('{0}/{1}'.format(rs[0] // g, rs[i] // g))
'Programming > Python & Data Structures' 카테고리의 다른 글
[Baekjoon/Python3] 3047번 ABC (0) | 2020.12.04 |
---|---|
[Baekjoon/Python3] 3046번 R2 (0) | 2020.12.04 |
[Baekjoon/Python3] 3035번 스캐너 (0) | 2020.12.04 |
[Baekjoon/Python3] 3009번 네 번째 점 (0) | 2020.12.04 |
[Baekjoon/Python3] 2965번 캥거루 세마리 (0) | 2020.12.04 |
Comments