제출 #503230

#제출 시각아이디문제언어결과실행 시간메모리
503230LoboBrunhilda’s Birthday (BOI13_brunhilda)C++17
20 / 100
12 ms2088 KiB
#include<bits/stdc++.h>
using namespace std;

const long long inf = (long long) 1e18 + 10;
const int inf1 = (int) 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()

#define maxn 110000
#define mxv 10000000

int m, q, p[maxn];

void solve() {
    cin >> m >> q;

    for(int i = 1; i <= m; i++) {
        cin >> p[i];
    }

    int x; cin >> x;
    int ans = 0;
    while(x != 0) {
        int mn = x;
        for(int i = 1; i <= m; i++) {
            mn = min(mn, x - x%p[i]);
        }

        if(mn == x) {
            cout << "oo" << endl;
            return;
        }

        x = mn;
        ans++;
    }

    cout << ans << endl;
    

}

int32_t main() {
    ios::sync_with_stdio(false); cin.tie(0);

    // freopen("in.in", "r", stdin);
    //freopen("out.out", "w", stdout);

    int tt = 1;
    // cin >> tt;
    while(tt--) solve();

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...