|
|
вернуться в форумwhy I get WA at test 8. what is wrong with my code: #include <iostream> #include <algorithm> #include <climits> #include <string> #include <cstring> #include <cmath> #include <vector> #include <stack> #include <map> #include <set> #include <iomanip> #include <unordered_map> #define ll long long #define fri(a, b) for (ll i = a; i < b; i++) #define frj(a, b) for (ll j = a; j < b; j++) #define frk(a, b) for (int k = a; k < b; k++) #define frh(a, b) for (int h = a; h < b; h++) #define frz(a, b) for (int z = a; z < b; z++) #define rfri(a, b) for (int i = a; i >= b; i--) #define rfrj(a, b) for (int j = a; j >= b; j--) #define yes cout << "YES" << "\n"; #define no cout << "NO" << "\n"; #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); const int mod=100000007; using namespace std; ll dp[50][1005]; ll func(ll n,ll s){ if(dp[n][s] != -1) return dp[n][s]; if(s == 0) return 1; if(n == 0){ if(s == 0) return 1; else return 0; } ll ans = 0; fri(0,10){ if((s - i) >= 0) ans = (ans + func(n-1,s-i)) ; } return dp[n][s] = ans; } int main() { fast ll T = 1; // cin >> T; frz(0,T){ ll n,s; cin >> n >> s; memset(dp,-1,sizeof(dp)); if(s%2) cout << 0 << "\n"; else { ll ans = func(n,s/2); cout << (ans*ans) << "\n"; } } } |
|
|