Notice
Recent Posts
목록수학 (1)
천천히 빛나는
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/q30PT/btsw2MwKhLP/hbLGPJMIuSAAUWpvADlIE1/img.png)
2609. (최대공약수와 최소공배수) 두 개의 자연수를 입력받아 최대 공약수와 최소 공배수를 출력하는 프로그램을 작성하시오. #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int a, b; cin >> a >> b; int minVal = 1; int n = min(a, b); while (n > 1) { if (a % n == 0 && b % n == 0) { minVal *= n; a /= n; b /= n; n = min(a, b); } n--; } cout > b; cout > a >> b; cout n; while (n--) { cin >> x; int temp = 0; ..
C++/BAEKJOON (C++)
2023. 10. 5. 21:44