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
int n, x, y, z; int dp[10055]; int rec(int at) { if(at == 0) { return 0; } if(dp[at] != -1) { return dp[at]; } int res = -2e7; if(at - x >= 0) { res = max(res, rec(at - x) + 1); } if(at - y >= 0) { res = max(res, rec(at - y) + 1); } if(at - z >= 0) { res = max(res, rec(at - z) + 1); } return dp[at] = res; } int maximizeTheCuts(int n, int x, int y, int z) { this->n = n; this->x = x; this->y = y; this->z = z; memset(dp, -1, sizeof dp); return rec(n) > 0 ? rec(n) : 0; }
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)