有没有哪位神犇指教一下,哪里错了
查看原帖
有没有哪位神犇指教一下,哪里错了
539770
ggggcyyyy楼主2021/8/17 21:38

样例都对

#include<bits/stdc++.h>
using namespace std;
struct stu
{
	string n;//姓名
	int m;//期末平均成绩
	int p;//班级评议成绩
	char s;//是否是学生干部
	char w;//是否是西部省份学生
	int d;//发表的论文数
};
int main()
{
    int stn,tm=0,max;
    stu st;
    cin>>stn;
    int mon[stn];
    string nm[stn],maxn;
    memset(mon,0,sizeof(mon));
    for(int i=0;i<=stn-1;i++)
    {
		cin>>st.n>>st.m>>st.p;
		cin>>st.s>>st.w>>st.d;
		if(st.m>80&&st.d>=1)
		    mon[i]+=8000;
		if(st.m>85&&st.p>80)
		    mon[i]+=4000;
		if(st.m>90)
		    mon[i]+=2000;
		if(st.m>85&&st.w=='Y')
		    mon[i]+=1000;
		if(st.p>80&&st.s=='Y')
		    mon[i]+=850;
		if(mon[i]>=max)
		{
			max=mon[i];
			maxn=st.n;
		}
	}
	for(int i=0;i<=stn-1;i++)
	{
		tm+=mon[i];
	}
	cout<<maxn<<endl<<max<<endl<<tm;

	return 0;
}
/*
4
YaoLin 87 82 Y N 0
ChenRuiyi 88 78 N Y 1
LiXin 92 88 N N 0
ZhangQin 83 87 Y N 1
*/
2021/8/17 21:38
加载中...