1015 德才论

#include "stdio.h"
#include 
#include 
#include 
//using std::sort;
using namespace std;
#define MAX 100005
struct stu{
    char num[10];
    int score1;
    int score2;
    int tag;
};
stu s[MAX];
int n,l,h,m=0;
bool cmp(stu s1,stu s2){
    if(s1.tag!=s2.tag) return s1.tag(s2.score1 +s2.score2);
    else if(s1.score1!=s2.score1) return s1.score1>s2.score1;
    else return strcmp(s1.num,s2.num)<0;
}
int main()
{
    //freopen("C:\\Users\\pc\\Desktop\\use.txt","r",stdin);
    scanf("%d %d %d\n",&n,&l,&h);
    stu temp;
    for(int i=0;i=h&&temp.score2>=h) {temp.tag=1;s[m++]=temp;}
        else if(temp.score1>=h&&temp.score2=l) {temp.tag=2;s[m++]=temp;}
        else if(temp.score1>=l&&temp.score1=l&&temp.score2=temp.score2) {temp.tag=3;s[m++]=temp;}
        else if(temp.score1>=l&&temp.score2>=l) {temp.tag=4;s[m++]=temp;}
        else continue;
    }
    sort(s,s+m,cmp);
    printf("%d\n",m);
    for(int i=0;i

你可能感兴趣的:(1015 德才论)