Problem 1-Dice Combinations Editorial- Now start from base 1->1 2->1+1,2+0 3->1+1+1,2+1,1+2,3+0 now for-4 we substract from 1 to min(6,4) ( we substract 1 then remaining 3 now we add no.of possible way to constuct 3)+(we substract 2 remaining(4-2=2,no of possible way to constuct 2)+(we substract 3,no. of possible way to construct 1)+(we substract 4 ,now of possible way to construct 0). i think you got the point base condition- dp[0]=1; how dp[0] ,for this there is empty subset exist Solution- #include < bits / stdc ++. h > using namespace std ; #define ll long long int #define str string #define pb push_back #define vc vector #define ci cin #define co cout #define mod 1000000007 ll dp [ 1000010 ]; int main () { ios_base :: sync_with_stdio ( false ); cin . tie ( NULL ); ll n ; cin >> n ; dp [ 0 ]= 1 ; for ( int i = 1 ; i <= n ; i ++) { ll ans = 0 ; for ( int j = 1 ; j <= min ( 6 ...
competitive programming guides eg.algorithms,problems,tricks ,datastructure based on cp.