QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#343343 | #8250. Magnesium Supplementation | MayaZayn# | WA | 0ms | 3592kb | C++14 | 1.4kb | 2024-03-02 14:10:18 | 2024-03-02 14:10:18 |
Judging History
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 '