【ACM】杭电OJ 1236(有问题)

ACCESS VIOLATION 

#include 
#include 
#include 
#include 
#include 
using namespace std;
int grade[20]={0};

typedef struct
{
	string id;
	int solved_total_num;
	int solved_num[20];
	int get_score;
}S;
S stu[1100];

void quick_sort1(int left,int right)
{
	int i,j;
	i=left;j=right;
	if(leftstu[i].id && istu[j].get_score && i>stu[i].id;
			scanf("%d",&stu[i].solved_total_num);
			for(j=1;j<=stu[i].solved_total_num;j++)
			{
				scanf("%d",&stu[i].solved_num[j]);
				stu[i].get_score+=grade[stu[i].solved_num[j]];
			}
			if(stu[i].get_score>=G)	count++;
		}
		printf("%d\n",count);
		quick_sort2(1,N);
		i=1;
		while(i=G)
			{
				cout<

AC

#include 
#include 
#include 
#include 
#include 
using namespace std;
int grade[22];

typedef struct
{
	string id;
	int solved_total_num;
	int solved_num[22];
	int get_score;
}S;
S stu[1010];

int comepare(S a,S b)
{
	if(a.get_score!=b.get_score)
		return a.get_score>b.get_score;
	else if (a.id>stu[i].id;
			scanf("%d",&stu[i].solved_total_num);
			for(j=1;j<=stu[i].solved_total_num;j++)
			{
				scanf("%d",&stu[i].solved_num[j]);
				stu[i].get_score+=grade[stu[i].solved_num[j]];
			}
			if(stu[i].get_score>=G)	count++;
		}
		printf("%d\n",count);
		i=1;
		sort(stu+1,stu+N+1,comepare);
		for(i=1;i<=N;i++)
		{
			if(stu[i].get_score>=G)
			{
				cout<

 

你可能感兴趣的:(ACM)