社区讨论

C语言,全wa,求大佬纠错

P5742【深基7.例11】评等级参与者 2已保存回复 1

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
1 条
当前快照
1 份
快照标识符
@mhk74jnq
此快照首次捕获于
2025/11/04 14:36
4 个月前
此快照最后确认于
2025/11/04 14:36
4 个月前
查看原帖
C
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
bool judge(int,int);
struct Student{
	int id;
	int scoreS;
	int scoreQ;
};
int main()
{
	int n,i;
	scanf("%d",&n);
	struct Student *p=(struct Student*)malloc(n*sizeof(struct Student));
	for( i=0; i<n; i++ ){
		scanf("%d %d %d",&p[i].id,&p[i].scoreQ,&p[i].scoreS);
	}
	for( i=0; i<n; i++ ){
		if(judge(p[i].scoreQ,p[i].scoreS))
			printf("Excellent\n");
		else
			printf("Not exellent\n");
	}
	free(p);
	return 0;
}
bool judge(int b,int c){
	int sum=0;
	sum=b+c;
	if(sum>140&&(b * 7 + c * 3)>=800)
		return true;
	else
		return false;
}

回复

1 条回复,欢迎继续交流。

正在加载回复...