Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a2b770b

Browse files
Update dynamic_programming_templates.cpp
1 parent b8788bd commit a2b770b

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

‎src/dynamic_programming_templates.cpp‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ long long solve(){
1212
}
1313
if(!exist[][]){
1414
long long answer = 0;
15-
//----type your code here----
1615

17-
//---------------------------
1816
dp[][] = answer;
1917
exist[][] = true;
2018
}
@@ -25,8 +23,7 @@ long long solve(){
2523
* Description: Digit DP
2624
*/
2725

28-
template<typename T> string toString(T value)
29-
{
26+
template<typename T> string toString(T value){
3027
string s;
3128
while (value) {
3229
s.push_back(value % 10 + '0');
@@ -40,8 +37,7 @@ template<typename T> string toString(T value)
4037
bool exist[][][];
4138
long long dp[][][];
4239

43-
long long solve(const string &s, int digit, bool bound, )
44-
{
40+
long long solve(const string &s, int digit, bool bound, ){
4541
if (digit == s.size()) {
4642
return;
4743
}
@@ -60,8 +56,8 @@ long long solve(const string &s, int digit, bool bound, )
6056

6157
/**
6258
* Description: Binary exponentiation DP (Non standard)
63-
* Note: Most of the same target problems can be solved through matrix exponentiation.
64-
* It helped me once doing a Div2-E (http://codeforces.com/problemset/problem/621/E)
59+
* Note: Most of the same target problems can be solved through matrix exponentiation.
60+
* It helped me once doing a Div2-E (http://codeforces.com/problemset/problem/621/E)
6561
*/
6662

6763
long long dp[105][105] = {};
@@ -105,7 +101,7 @@ long long solve(const string &s, int digit, bool bound, )
105101

106102
/**
107103
* Description: Bitwise combinatorial DP
108-
* Note: Target problems include no of pairs (x, y)
104+
* Note: Target problems include no of pairs (x, y)
109105
such that x <= A, y <= B, (x op y) <= C, where op is a bitwise operator.
110106
*/
111107

@@ -157,4 +153,4 @@ int main(){
157153
scanf("%lld%lld%lld", &a, &b, &c);
158154
A = toBinaryString(a); B = toBinaryString(b); C = toBinaryString(c);
159155
printf("%lld\n", solve(0, true, true, true, true));
160-
}
156+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /