0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 18:48:48 +00:00

#9. 土地利用

https://sjzezoj.com/submission/58915
This commit is contained in:
Baoshuo Ren 2022-10-01 19:44:24 +08:00
parent 713d5e6156
commit eecfe2dbac
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
14 changed files with 69 additions and 0 deletions

30
S2OJ/9/9.cpp Normal file
View File

@ -0,0 +1,30 @@
#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 20005;
int s, n, a[N], f[N];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> s >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
for (int j = s; j >= a[i]; j--) {
f[j] = std::max(f[j], f[j - a[i]] + a[i]);
}
}
cout << s - f[s] << endl;
return 0;
}

BIN
S2OJ/9/data/ex_land1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/ex_land1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/land5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/9/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.