Java面试题---摘要牛客网-CSDN博客 package extendNiuKeWang; import java.util.Scanner; public class GoodHuaWei { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int money = sc.nextInt(); System.out.println("n值总金额:"+money); int n = sc.nextInt(); System.out.println("n值总件数:"+n); if(n<=0||money<=0) { System.out.println(0); } // good[] Gs = new good[n+1]; for (int i = 1; i <= n; i++) { int v = sc.nextInt(); System.out.println("第一件价格:"+v); int p = sc.nextInt(); System.out.println("第一件重要度:"+p); int q = sc.nextInt(); System.out.println("第一件是附件还是主件: