Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
using namespace std; int dp[100000]; int n; vector
w1; vector
v1; int rec(int weight1){ if(weight1==0){ return 0; } if(dp[weight1]!=-1){ return(dp[weight1]); } int result=0; for(int j=0; j
=0){ result=max(result, rec(weight1-w1[j])+v1[j]); } } dp[weight1]=result; return result; } int main() { int w; cin>>n>>w; for(int i=0; i
>a>>b; w1.push_back(a); v1.push_back(b); } for(int i=0; i<100000; i++){ dp[i]=-1; } cout<
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)