c语言中分数线怎么看,分数线划定 C/C++

4193ed3ff6030b9a9418e896b216b19e.png

c1e1b496baf7082d00da7911b34879d7.png

8903c1207f9539a676e9393c3e5bbfd7.png

只A了一个,后面全WA了

代码如下

include

using namespace std;

struct Person

{

int number;

int score;

};

struct Person person[5001];

int main()

{

int n,m;

int total;

cin >> n >> m;

total = (int) (m*1.5 + 0.5);

for(int i = 1; i <= n; i++)

cin >> person[i].number >> person[i].score;

for(int i = 1; i <= n-1; i++)

for(int j = 1; j <= n-i; j++)

{

struct Person temp;

if(person[j].score < person[j + 1].score)

{

temp = person[j];

person[j] = person[j + 1];

person[j + 1] = temp;

}

if(person[j].score == person[j + 1].score && person[j].number > person[j + 1].number )

{

temp = person[j];

person[j] = person[j + 1];

person[j + 1] = temp;

}

}

cout << person[total].score << " " << total << endl;

for(int i = 1; i <= total; i++)

cout << person[i].number << " " << person[i].score << endl;

return 0;

}

样例过了,但不知道哪里错了,求教,谢谢!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值