-
Notifications
You must be signed in to change notification settings - Fork 0
/
H.cpp
48 lines (44 loc) · 1.03 KB
/
H.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// 2023 NAQ: Magnesium Supplementation
/*
Im Nayeon
Yoo Jeongyeon
Momo Jjang
Sana Jjang
Park Jihyo
Mina Jjang
Kim Dahyun
Son Chaeyoung
Chou Tzuyu
One in a million
눈부시게 사랑해
트와이스 !!
*/
%:include <bits/stdc++.h>
using namespace std;
%:define int long long
typedef vector<int> vi;
typedef pair<int, int> pii;
%:define order(a) sort(a.begin(), a.end())
%:define rev(a) sort(a.rbegin(), a.rend())
%:define pb(x) push_back(x)
%:define forn(i, n) for(int i = 0; i < n; ++i)
void solve() <%
//code
int N, K, P; cin >> N >> K >> P;
// you need to make exactly 'N', using no more than 'P' pills, and each being at most 'K'
vector<int> ans;
for (int i = 1; i * i <= N; i++) {
if (N % i != 0) continue;
if (i <= K && N/i <= P) ans.pb(i);
if (i * i != N && N/i <= K && i <= P) ans.pb(N / i);
}
order(ans);
cout << ans.size() << '\n';
for (int x : ans) cout << x << '\n';
%>
signed main() <%
cin.tie(0)->sync_with_stdio(0);
int T = 1;
// cin >> T;
while (T --> 0) solve();
%>