mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:11:58 +00:00
parent
e49b75789d
commit
838adadd01
35
S2OJ/1495/1495.cpp
Normal file
35
S2OJ/1495/1495.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1005;
|
||||
|
||||
int n, v[N], w[N], f[N], ans;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> v[i];
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> w[i];
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
for (int j = n; j >= v[i]; j--) {
|
||||
f[j] = std::max(f[j], f[j - v[i]] + w[i]);
|
||||
ans = std::max(ans, f[j]);
|
||||
}
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1495/data/data1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/data9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/data9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1495/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1495/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user