Home > Back-end >  How to correct
How to correct

Time:01-07

How to change the code below to this requirement. Input an integer N, said a total of N group test data;
The next input the N groups of test data, test data in each group made up of several integers, said the weight, the integer on - on the same line, with 0 as a marker of the end of the test data in each group,
The first line is an integer N, said - a total of N group of test data;




#include
#include
using namespace std;
Int main () {//the order of the priority queue for small in team head priority_queue & lt; Int, vector Greater q;
Int n, x;
Cin & gt;> n;
for(int i=0; I & lt; n; I++) {
Cin & gt;> x;
Q.p ush (x); }
Int ans=0;
While (q.s considering () & gt; 1)
{int a, b;
A=q.t op ();
Q.p op ();
B=q.t op ();
Q.p op ();
Q.p ush (a + b);
Ans +=a + b; }
Cout & lt; return 0; }
  • Related