从零开始一小白 2019-09-22 11:10 采纳率: 0%
浏览 319

PATA1062答案部分正确是为什么?

PATA1062答案部分正确是为什么?为什么只有一个测试点数据通过了?一般情况下造成答案部分正确的原因是什么呢?
#include
#include
#include
using namespace std;

const int maxn=100010;
struct student{
char id[10];
int de,cai,sum;
int flag;
}stu[maxn];

bool cmp(student a,student b){
if(a.flag!=b.flag) return a.flag else if(a.sum!=b.sum) return a.sum>b.sum;
else if(a.de!=b.de) return a.de>b.de;
else return strcmp(a.id,b.id)<0;
}

int main(){
int n,L,H;
scanf("%d%d%d",&n,&L,&H);
for(int i=0;i scanf("%s%d%d",stu[i].id,&stu[i].de,&stu[i].cai);
}
for(int j=0;j if (stu[j].de else if(stu[j].de>=H&&stu[j].cai>=H) stu[j].flag=1;
else if(stu[j].de>=H&&stu[j].cai else if(stu[j].de>stu[j].cai) stu[j].flag=3;
else stu[j].flag=4;
}
sort(stu,stu+n,cmp);
printf("%d\n",n);
for(int i=0;i<n;i++){
printf("%s %d %d\n",stu[i].id,stu[i].de,stu[i].cai);

}
return 0;

}

  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2019-09-23 13:14
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条