fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const long long MOD = 1e9 +7 ;
  5. long long dp[10002][102] ;
  6. int K;
  7. long long solve(long long dif ,int t){
  8. if(t == 0){
  9. return (dif > 9000) ;
  10. }
  11. while(dif < 0){}
  12. if(dp[dif][t] != -1)
  13. return dp[dif][t] ;
  14. long long &ret = dp[dif][t] ;
  15. ret = 0 ;
  16. for(int i = -K ; i <= K ; i++)
  17. for(int j = -K ; j <= K ; j++)
  18. ret = (ret + solve(dif + i - j , t - 1))%MOD ;
  19. return ret ;
  20. }
  21. int main(int argc,char* argv[]) {
  22.  
  23. int a,b,t ;
  24. cin >> a >> b >> K >> t ;
  25. memset(dp , -1 , sizeof(dp)) ;
  26. long long ans = solve(a-b+9000,t) ;
  27. while(ans < 0) ans += MOD ;
  28. while(ans >= MOD) ans -= MOD ;
  29. cout << ans << endl ;
  30. return 0 ;
  31. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main(int, char**)':
prog.cpp:25:32: error: 'memset' was not declared in this scope
     memset(dp , -1 , sizeof(dp)) ;
                                ^
stdout
Standard output is empty