QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#343343#8250. Magnesium SupplementationMayaZayn#WA 0ms3592kbC++141.4kb2024-03-02 14:10:182024-03-02 14:10:18

Judging History

你现在查看的是最新测评结果

  • [2024-03-02 14:10:18]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3592kb
  • [2024-03-02 14:10:18]
  • 提交

answer

#include <bits/stdc++.h>
#define MayaZayn ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define all_r(x) (x).rbegin(), (x).rend()
#define mnEl(vec) *min_element(vec.begin(), vec.end())
#define mxEl(vec) *max_element(vec.begin(), vec.end())
#define yes cout << "YES"
#define no cout << "NO"
#define in(v) for (auto & x : v) cin >> x
#define out(v) for (auto & x : v) cout << x << ' '
#define inLL(v) for (ll & x : v) cin >> x
#define openIn(x) freopen(x, "r", stdin);
#define openOut(x) freopen(x, "w", stdout);
#define M 1000000007
#define N 100005

using namespace std;

vector<ll> factorize(ll n, ll mx) {
    vector<ll> ans;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            if (i <= mx)
                ans.push_back(i);
            if (n / i != i && n/i <= mx)
                ans.push_back(n / i);
        }
    }
    sort(all(ans));
    return ans;
}

void solve() {
    ll n, k, p;
    cin >> n >> k >> p;
    vector<ll> f = factorize(n, k);
    vector<ll> ans;
    for (int i = 0; i < f.size(); ++i) {
        if (n / f[i] <= p)
            ans.push_back(f[i]);
    }
    cout << ans.size() << endl;
    out(ans);
}

int main() {
    MayaZayn

//    int t;
//    cin >> t;
//    while (t--)
    solve();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3592kb

input:

6 6 4

output:

3
2 3 6 

result:

wrong answer 2nd lines differ - expected: '2', found: '2 3 6 '