728x90
반응형
1. intro
2. code 및 분석
2.1. code
N/A
2.2. 분석
최대공약수 즉 GCD를 구하는 문제이다.
이는 유클리드 호제법을 통해 쉽게 구할 수 있으며, 아래 링크와 같이 직접 만들어보았다.
2023.02.01 - [Tips & theory] - Euclidean algorithm - 유클리드 호제법
3. exploit
a = int(input())
b = int(input())
while 1:
if a < b:
a,b = b,a
GCD = b
if (a % b) == 0:
break
a = a % b
print(GCD)
┌──(kali㉿kali)-[~/Downloads]
└─$ python GCD.py
66528
52920
1512
728x90
반응형
'Wargame > Cryptohack' 카테고리의 다른 글
Modular Arithmetic 1 (0) | 2023.02.03 |
---|---|
Extended GCD (0) | 2023.02.02 |
You either know, XOR you don't (0) | 2023.02.01 |
Favourite byte (0) | 2023.01.31 |
XOR properties (0) | 2023.01.31 |