Skip to content

Commit a1973d0

Browse files
authored
Add files via upload
commit for the sol of 189A.cpp
1 parent d46b633 commit a1973d0

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

189A.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
5+
int main()
6+
{
7+
ios::sync_with_stdio(false);
8+
int n, a, b, c, pieces = 0;
9+
cin >> n >> a >> b >> c;
10+
11+
for (int i = 0; i*a <= n; ++i)
12+
{
13+
for (int j = 0; i*a + j*b <= n; ++j)
14+
{
15+
int k = (n - i*a - j*b)/c;
16+
if (i*a + j*b + k*c == n)
17+
pieces = max(i + j + k, pieces);
18+
19+
20+
}
21+
}
22+
cout << pieces <<"\n";
23+
24+
}

0 commit comments

Comments
 (0)