[PAT] Class 1080 Graduate Admission (30 points)

Meaning of the questions:

Input three positive integers N, M, K (N <= 40000, M <= 100, K <= 5) denote the number of students, the total number of candidates for the school, students can fill Number of Volunteers. Then enter a line M represents a positive integer from 0 to M-1 number of each school enrollment, N rows and K each comprise two grades volunteer. M output lines of output per number of students admitted to the school in accordance with the principle of parallel voluntary, if the same results, you can break through the number of planned admissions.

trick:

I do not really understand why, when output using if (i> 0) cout << "\ n"; the test will lead to points 2 and 4 format error. . . . .

Found last line must want to change the line. . .

Code:

#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
typedef struct student{
int x,y;
int id;
int c[7];
};
student d[40007];
int a[107];
int b[7];
vector<int>ans[107];
bool cmp(student a,student b){
if(a.x+a.y!=b.x+b.y)
return a.x+a.y>b.x+b.y;
return a.x>b.x;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,m,k;
cin>>n>>m>>k;
for(int i=0;i<m;++i)
cin>>a[i];
for(int i=0;i<n;++i){
cin>>d[i].x>>d[i].y;
for(int j=1;j<=k;++j)
cin>>d[i].c[j];




























cout<<"\n";
}
return 0;
}

Guess you like

Origin www.cnblogs.com/ldudxy/p/11839051.html