CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 10:14:10 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=c2788e8eef6a1f3d6f26b23976e57063b80096854c59a3de06e851008e13da04a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22ACw6P8krP-mRKB5XG_bJqamK4s8hwf8q%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d5d4275d75d817-BLR
LIGHT OJ 1231 - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- _________
- / \
- / _ _ \
- / 0 0 \
- | || |
- | | => HI
- \ ----- /
- \ /
- \_ _ _ _ _/
- */
- #include<bits/stdc++.h>
- using namespace std;
- using lli = int64_t;
- const int maxN = 1010;
- lli grid[51][maxN];
- lli solve(int coins[],int coins_count[],int idx,int k,int n){
- if(idx == n or k == 0){
- return (k == 0);
- }
- if(grid[idx][k] != -1){
- return grid[idx][k];
- }
- lli res = 0;
- for(int i = 0;i <= coins_count[idx]; i++){
- if(k - (coins[idx] * i) >= 0){
- res += solve(coins,coins_count,idx + 1,k - (coins[idx] * i),n);
- }
- }
- return grid[idx][k] = res % 100000007;
- }
- int main(){
- ios::sync_with_stdio(false);
- cin.tie(nullptr);
- int T;
- cin >> T;
- for(int t = 1; t <= T; t++){
- memset(grid,-1,sizeof(grid));
- int n,k;
- cin >> n >> k;
- int coins[51],coins_count[51];
- for(int i = 0;i < n; i++){
- cin >> coins[i];
- }
- for(int i = 0;i < n; i++){
- cin >> coins_count[i];
- }
- cout << "Case " << t << ": " << solve(coins,coins_count,0,k,n) << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ C
JavaScript | 7 sec ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ 9
JavaScript | 9 sec ago | 0.25 KB
-
Free Crypto Method (NEVER SEEN BEFORE)⭐⭐ P
JavaScript | 16 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ D
JavaScript | 18 sec ago | 0.25 KB
-
⭐✅ Swapzone Glitch ✅ Working ⭐⭐ A
JavaScript | 25 sec ago | 0.25 KB
-
📌 Swapzone +37% glitch ⭐ Y
JavaScript | 28 sec ago | 0.25 KB
-
✅ Make $2500 in 20 minutes⭐⭐⭐ I
JavaScript | 33 sec ago | 0.25 KB
-
✅⭐ Make huge profits on trading ⭐⭐ C
JavaScript | 40 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand