약수 배수와 소수 23 [백준 2485번][C++] 가로수 #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int gcd(int big, int small) { int r = big % small; if (r == 0) return small; else return gcd(small, r); } int main() { // 쓰레드 환경이 아닐때 버퍼를 분리하여 처리속도를 빠르게 해줌 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int N; cin >> N; vector v(N); for (int i = 0; i .. 2023. 8. 7. [백준 1735번][C++] 분수 합 #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int gcd(int big, int small) { // 유클리드 호제법 int r = big % small; // 나머지 if (big % small == 0) return small; else return gcd(small, r); } int main() { // 쓰레드 환경이 아닐때 버퍼를 분리하여 처리속도를 빠르게 해줌 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int A, B, C, D; cin.. 2023. 8. 7. [백준 13241번][C++] 최소공배수 #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { // 쓰레드 환경이 아닐때 버퍼를 분리하여 처리속도를 빠르게 해줌 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int A, B; cin >> A >> B; long long small = A > B ? B : A; long long big = A == small ? B : A; long long k = 1; long long minVal = small; // 최소 공.. 2023. 8. 7. 이전 1 다음