...Your html-escaped code goes here...
#include#include #include using namespace std; int main() { int capacity,elements; int weight[100],value[1000]; int dp[1000];///store the maximum value printf("How many elements: "); cin>>elements; printf("Enter the maximum weight: "); cin>>capacity; printf("Enter the weight and value of each element: \n"); for(int i=1;i<=elements;i++) cin>>weight[i]>>value[i]; memset(dp,0,sizeof dp); for(int i=1;i<=elements;i++) { for(int j=capacity;j>=weight[i];j--) { if(dp[j]
0 comments:
একটি মন্তব্য পোস্ট করুন