알고리즘

[알고리즘] 백준 1145 - 적어도 대부분의 배수

blueberrysoda 2024. 7. 28. 23:01
#include <iostream>
using namespace std;

int Arr[5];
int Ans = 1;

int main(){
    for(int i=0; i<5; i++){
        cin >> Arr[i];
    }

    while(true){
        int cnt = 0;
        for(int i=0; i<5; i++){
            if(Ans % Arr[i] == 0){
                cnt++;
            }
        }
        if(cnt >= 3){
            cout << Ans << "\n";
            break;
        }
        Ans++;
    }

    return 0;
}