[KNAPSACK 알고리즘] -> 목표 무게 이내의 가방 최대 이익 구하기 import java.util.Scanner; public class KnapsackTest { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int N=sc.nextInt(); //가방 개수 int W=sc.nextInt(); //가방 목표 무게 int[] weights= new int[N+1]; int[] profits=new int[N+1]; for(int i=1;i