PAT(PAT Ranking)


失分点:

  • and the output must be sorted in nondecreasing order of their registration numbers. 成绩相同的时候用准考证号码由小到大排序。

a.score != b.score ? a.score > b.score : a.id < b.id;

  • registration number (a 13-digit number) 准考证号固定13位,但是当输入为000000011111时存储之后再打印就是11111了,所以要小心。

printf("%013lld %d %d %d\n",stu[i].id.....);

合格代码:

#include
#include
#include
using namespace std;
#define N 30000
typedef struct Stu{
  long long id;
  int score;
  int final_rank;
  int location_number;
  int local_rank;
  Stu(){
    id=0;
    score=0;
    final_rank=0;
    location_number=0;
    local_rank=0;
  }
}Stu;
int locations=0;
int length[N]={0};
bool cmp(Stu a,Stu b){
  return a.score != b.score ? a.score > b.score : a.id < b.id;
}
int main(){
  // freopen("test.txt","r+",stdin);
  scanf("%d",&locations);
  int i,j;
  vectorstu;
  for(i=0;is;
    for(j=0;j

你可能感兴趣的:(PAT(PAT Ranking))