想不懂的0分啊!!!!

###Block Code
#include <iostream>
#include <string>
using namespace std;
int n,money[101]={},maxx=0,sum=0;
struct a{
string name;
int avg,clas,art;
char west,leader;
}info[101];
int main()
{
cin>>n;
for (int i=1;i<=n;i++)
cin>>info[i].name>>info[i].avg>>info[i].clas>>info[i].leader>>info[i].west>>info[i].art;
for (int i=1;i<=n;i++)
{
if (info[i].avg>=90)
money[i]+=2000;
if (info[i].avg>=85)
{
if (info[i].west=='Y')
money[i]+=1000;
if (info[i].clas>=80)
money[i]+=4000;
}
if (info[i].avg>=80&&info[i].art>=1)
money[i]+=8000;
if (info[i].clas>=80&&info[i].leader=='Y')
money[i]+=850;
}
for (int i=1;i<=n;i++)
{
if (maxx<money[i])
maxx=money[i];
sum+=money[i];
}
for (int i=1;i<=n;i++)
if (maxx==money[i])
{
cout<<info[i].name<<endl<<money[i]<<endl<<sum;
break;
}
return 0;
}

1 条评论

  • @ 2013-10-05 16:18:29

    ###Block Code
    #include <iostream>
    #include <cstdio>
    using namespace std;
    int n,i,tot;
    char ch1,ch2;
    struct student
    {
    string name;
    int qimo,yiping,leader,west,artical,scholar;
    };
    student stu[101];

    int main()
    {
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    {
    // scanf("%s%d%d%c%c%d",&stu[i].name,&stu[i].qimo,&stu[i].yiping,
    // &ch1,&ch2,&stu[i].artical);
    cin>>stu[i].name>>stu[i].qimo>>stu[i].yiping>>ch1>>ch2>>stu[i].artical;
    if (ch1=='Y') stu[i].leader=1; else stu[i].leader=0;
    if (ch2=='Y') stu[i].west=1; else stu[i].west=0;
    if (stu[i].qimo>80&&stu[i].artical>0) stu[i].scholar+=8000;
    if (stu[i].qimo>85&&stu[i].yiping>80) stu[i].scholar+=4000;
    if (stu[i].qimo>90) stu[i].scholar+=2000;
    if (stu[i].qimo>85&&stu[i].west==1) stu[i].scholar+=1000;
    if (stu[i].yiping>80&&stu[i].leader==1) stu[i].scholar+=850;
    if (stu[i].scholar>stu[0].scholar) stu[0]=stu[i];
    tot+=stu[i].scholar;
    }
    printf("%s\n%d\n%d\n",stu[0].name.c_str(),stu[0].scholar,tot);
    // cout<<stu[0].name<<endl<<stu[0].scholar<<endl<<tot<<endl;
    return 0;
    }

  • 1

信息

ID
1001
难度
5
分类
模拟 点击显示
标签
递交数
39307
已通过
12806
通过率
33%
被复制
132
上传者