public class Main4 {     public static void main(String[] args) {         Scanner sc = new Scanner(System.in);         int n = sc.nextInt();         Node[] node = new Node[n]; //表示关卡         for (int i = 0; i < n; i++) {             int a = sc.nextInt();             int b = sc.nextInt();             node[i] = new Node(a,b);         }         Arrays.sort(node,(o1,o2)->o1.v==o2.v?o2.point-o1.point:o1.v-o2.v);         int sum = 0;         for (Node nd : node) {             if(nd.v==0){                 sum+=nd.point;             }else{                 if(sum+nd.point<2*sum){ //用宝物                     sum*=2;                 }else                     sum+=nd.point;  //不用宝物             }         }         System.out.println(sum);     } } class  Node{     int point;  //分数     int v;    //是否有宝物     public Node(int point,int v){         this.point = point;         this.v = v;     }  }  第二题,我这个不知道对不对,自测了几个用例都可以过,最后时间不够没提交上去