451 条题解

  • 27
    @ 2016-12-10 10:15:10
    #include<iostream>
    using namespace std;
    int main()
    {
        string a,g;
        int b,c,f,n,money=0,result=0,sum=0;
        char d,e;
        cin>>n;
        for(int i=1;i<=n;i++)
        {
            cin>>a>>b>>c>>d>>e>>f;
            money=0;
            if(b>80&&f>=1)
            money+=8000;
            if(b>85&&c>80)
            money+=4000;
            if(b>90)
            money+=2000;
            if(b>85&&e=='Y')
            money+=1000;
            if(c>80&&d=='Y')
            money+=850;
            sum+=money;
            if(result<money)
            {
                result=money;
                g=a;
            }
        }
        cout<<g<<endl<<result<<endl<<sum<<endl;
        return 0;
    }
    
  • 3
    @ 2009-04-04 09:45:58

    输入数据时千万要记得 占位符 加空格

    scanf("%s %d %d %c %c %d"

  • 2
    @ 2019-11-20 22:13:19

    这里用到了结构数组动态分配内存大家可以看看
    #include<iostream>
    #include<string>
    #include<malloc.h>
    #define LEN sizeof(struct Student)
    using namespace std;
    struct Student{
    char name[100];
    int gard_exam;
    int gard_evaluate;
    char student_leader[1];
    int nums_paper;
    char student_west[1];

    };

    int main(){
    int n;
    cin >> n;
    struct Student *stu=NULL;
    stu = (struct Student *)malloc(sizeof(struct Student)*n);
    for (int i = 0; i < n; i++){
    cin >> stu[i].name >> stu[i].gard_exam >> stu[i].gard_evaluate >> stu[i].student_leader >> stu[i].student_west >> stu[i].nums_paper;
    }
    int sum_grad=0;
    int max_grad = 0;
    string name_cout;
    for (int i = 0; i < n; i++){
    int t_grad = 0;
    if (stu[i].gard_exam > 80 && stu[i].nums_paper >= 1){
    t_grad += 8000;
    }
    if (stu[i].gard_exam > 85 && stu[i].gard_evaluate > 80){
    t_grad += 4000;
    }
    if (stu[i].gard_exam > 90){
    t_grad += 2000;
    }
    if (stu[i].gard_exam > 85 && stu[i].student_west[0]=='Y'){
    t_grad += 1000;
    }
    if (stu[i].gard_exam > 80 && stu[i].student_leader[0] == 'Y'){
    t_grad += 850;
    }
    sum_grad = sum_grad+t_grad;
    if (max_grad < t_grad){
    max_grad = t_grad;
    name_cout = stu[i].name;
    }
    }
    cout << name_cout << endl;
    cout << max_grad << endl;
    cout << sum_grad << endl;
    }

  • 1
    @ 2020-02-01 16:44:13
    /*
    用类的思想对学生信息进行封装,添加学生基本信息
    定义计算学生奖学金的函数,用多个判断语句计算学生奖学金
    最后进行比较
    */
    #include <iostream>
    
    using namespace std;
    
    class students {
    public:
        char name[20], cadre, west;
        int finalgrade, classgrade, thesis, scholarship = 0;
        void scholarshipcount(void) {
            if (this->finalgrade > 80 && this->thesis > 0)scholarship += 8000;
            if (this->finalgrade > 85 && this->classgrade > 80)scholarship += 4000;
            if (this->finalgrade > 90)scholarship += 2000;
            if (this->finalgrade > 85 && this->west == 'Y')scholarship += 1000;
            if (this->classgrade > 80 && this->cadre == 'Y')scholarship += 850;
        }
        students(){}
        ~students(){}
    };
    int main()
    {
        int N, totalscholarship = 0;
        students student[100];
        cin >> N;
        for (int i = 0; i < N; i++) {
            cin >> student[i].name >> student[i].finalgrade >> student[i].classgrade >> student[i].cadre
                >> student[i].west >> student[i].thesis;
            student[i].scholarshipcount();
            totalscholarship += student[i].scholarship;
        }
        students studentbest=student[0];
        for (int i = 1; i < N; i++) {
            if (studentbest.scholarship < student[i].scholarship)studentbest = student[i];
        }
        cout << studentbest.name << endl << studentbest.scholarship << endl << totalscholarship;
        return 0;
    }
    
  • 1
    @ 2019-12-01 16:47:08
    some_stu = []
    money_max = 0
    money_count = 0
    money_name = '0'
    for i in range(int(input())):
        some_stu.append((input().split()))
    for item in some_stu:
        money = 0
        money += 8000 if int(item[1]) > 80 and int(item[5]) >= 1 else 0
        money += 4000 if int(item[1]) > 85 and int(item[2]) > 80 else 0
        money += 2000 if int(item[1]) > 90 else 0
        money += 1000 if int(item[1]) > 80 and item[4] == 'Y' else 0
        money += 850 if int(item[2]) > 80 and item[3] == 'Y' else 0
        money_count += money
        if money > money_max:
            money_name = item[0]
            money_max = money
    print(money_name)
    print(money_max)
    print(money_count)
    
    

    python 不知道错哪了

  • 1
    @ 2019-09-27 19:41:51

    暴力模拟,大H2O题目
    祝大家全AC

    
    #include<bits/stdc++.h>
    #define FOR(i,n,m) for(int i=n;i<=m;i++)
    using namespace std;
    struct student{
        string name;
        int endtest,classtest,stu,west,lw,money;
    }a[105];
    int n,allmoney,ans=0,now=0;
    int main()
    {
        char s,w;
        cin>>n;
        FOR(i,1,n)
        {
            cin>>a[i].name;
            cin>>a[i].endtest>>a[i].classtest;
            cin>>s>>w>>a[i].lw;
            if(s=='Y')
            a[i].stu=1;
            else
            a[i].stu=0;//是否是学生干部 
            
            if(w=='Y')
            a[i].west=1;
            else
            a[i].west=0;//是否是西部学生 
            
            //开始颁发奖学金 
            if(a[i].endtest>80&&a[i].lw>=1)
            a[i].money+=8000;//院士奖学金
            
            if(a[i].endtest>85&&a[i].classtest>80)
            a[i].money+=4000;//五四奖学金
            
            if(a[i].endtest>90)
            a[i].money+=2000;//成绩优秀奖
            
            if(a[i].endtest>85&&a[i].west==1)
            a[i].money+=1000;//西部奖学金
            
            if(a[i].classtest>80&&a[i].stu==1)
            a[i].money+=850;//班级贡献奖
            
            allmoney+=a[i].money;//计算发出奖学金总和    
            
            if(now<a[i].money)
            {
                now=a[i].money;
                ans=i;
            }//查找奖学金最高者 
        }
    
    
        cout<<a[ans].name<<'\n'<<a[ans].money<<'\n'<<allmoney;
        return 0;
    }
    
  • 1
    @ 2019-05-26 17:03:48
    #include <cstdio>
    #include <cstdlib>
    #include <cmath>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    int n,maxsum,sum;
    char maxname[30];
    struct data
    {
        char name[30];
        int s1;
        int s2;
        char a[2];
        char b[2];
        int tot;
        int s;
    }
    ;
    data d[110];
    int main()
    {
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
        {
            scanf("%s%d%d%s%s%d",d[i].name,&d[i].s1,&d[i].s2,d[i].a,d[i].b,&d[i].tot);
            if(d[i].s1>80 && d[i].tot)    d[i].s+=8000;
            if(d[i].s1>85 && d[i].s2>80)    d[i].s+=4000;
            if(d[i].s1>90)  d[i].s+=2000;
            if(d[i].s1>85 && d[i].b[0]=='Y')    d[i].s+=1000;
            if(d[i].s2>80 && d[i].a[0]=='Y')    d[i].s+=850;
            if(d[i].s>maxsum)
            {
                
                strcpy(maxname,d[i].name);
                maxsum=d[i].s;
            }
            sum+=d[i].s;
        }
        printf("%s\n%d\n%d\n",maxname,maxsum,sum);
    
        return 0;
    }
    
  • 1
    @ 2019-02-11 18:48:06
    /*
    @createTime 2019.2.10
    @Author YeahQing
    @problemName 谁拿了最多奖学金
    */
    
    //姓名,期末平均成绩,班级评议成绩,是否是学生干部,是否是西部省份学生,以及发表的论文数
    #include <iostream>
    
    using namespace std;
    
    struct Student {
        char name[20];
        int avgScore;
        int classScore;
        char isLeader[2];
        char isWest[2];
        int publishPaper;
        int totalPrice = 0;
    };
    
    int isMasterPrice(int avgScore, int publishPaper) {
        if (avgScore > 80 && publishPaper > 0) {
            return 1;
        }
        else {
            return 0;
        }
    }
    
    int isFFPrice(int avgScore,int classScore) {
        if (avgScore > 85 && classScore > 80) {
            return 1;
        }
        else {
            return 0;
        }
    }
    
    int isScoreExcellent(int avgScore) {
        if (avgScore > 90) {
            return 1;
        }
        else {
            return 0;
        }
    }
    
    int isWestPrice(int avgScore, char *isWest) {
        if (avgScore > 85 && *isWest == 'Y' ) {
            return 1;
        }
        else {
            return 0;
        }
    }
    
    int isClassContribution(int classScore, char *isLeader) {
        if (classScore > 80 && *isLeader == 'Y') {
            return 1;
        }
        else {
            return 0;
        }
    }
    
    int main() {
        Student stu[100],res;
        int n;
        int totalPrice = 0;
        cin >> n;
        for (int i = 0; i < n; i++) {
            cin >> stu[i].name
            >> stu[i].avgScore
            >> stu[i].classScore
            >> stu[i].isLeader
            >> stu[i].isWest
            >> stu[i].publishPaper;
        }
    
        res = stu[0];
    
        for (int i = 0; i < n; i++) {
            if (isMasterPrice(stu[i].avgScore, stu[i].publishPaper) == 1) {
                stu[i].totalPrice += 8000;
            }
            if (isFFPrice(stu[i].avgScore, stu[i].classScore) == 1) {
                stu[i].totalPrice += 4000;
            }
            if (isScoreExcellent(stu[i].avgScore) == 1) {
                stu[i].totalPrice += 2000;
            }
            if (isWestPrice(stu[i].avgScore, stu[i].isWest) == 1) {
                stu[i].totalPrice += 1000;
            }
            if (isClassContribution(stu[i].classScore, stu[i].isLeader) == 1) {
                stu[i].totalPrice += 850;
            }
            totalPrice += stu[i].totalPrice;
            if (res.totalPrice < stu[i].totalPrice) {
                res = stu[i];
            }
        }
        
        cout << res.name << '\n'
            << res.totalPrice << '\n'
            << totalPrice;
        
    
        return 0;
    }
    
  • 0
    @ 2020-02-09 20:47:18
    #include <stdio.h>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    struct stu {
        int id;
        char name[100];
        int qm,py;
        char gb,xb;
        int lw,jj;
    }a[110];
    int jxj (int qm,int py,char gb,char xb,int lw) {
        int jj=0;
        if (qm>80&&lw>=1) jj+=8000;
        if (qm>85&&py>80) jj+=4000;
        if (qm>90) jj+=2000;
        if (qm>85&&xb=='Y') jj+=1000;
        if (py>80&&gb=='Y') jj+=850;
        return jj;
    }
    bool operator <(const stu &p1,const stu &p2) {
        if (p1.jj!=p2.jj) return p1.jj<p2.jj;
        return p1.id>p2.id; 
    }
    int main () {
        int n,i,zq=0;
        scanf ("%d",&n);
        for (i=0;i<n;i++) {
            scanf ("%s%d%d %c %c%d",
            a[i].name,&a[i].qm,&a[i].py,&a[i].gb,&a[i].xb,&a[i].lw);
            a[i].jj=jxj(a[i].qm,a[i].py,a[i].gb,a[i].xb,a[i].lw);
            a[i].id=i+1;
            zq+=a[i].jj;
        }
        sort (a,a+n);
        printf ("%s\n",a[i-1].name);
        printf ("%d\n",a[i-1].jj);
        printf ("%d",zq);
        return 0;
    }
    
  • 0
    @ 2019-08-18 15:02:51

    分析一下思路:
    1. 输入各类数据
    2. 算出每个人的奖金数,注意,在算的时候要使用if-if,不能使用if-else if - else结构,因为每个人都可以领多个奖学金,所以有些人符合多个条件
    3. 遍历数组,寻找最多奖学金,求出全部奖金和
    4. 输出有最多奖学金的人,最多的奖学金,以及总共奖学金

    /*
        @createTime 2019.2.10
        @Author C++语言学习者青云
        @problemName 谁拿了最多奖学金
    */
    #include <iostream>
    using namespace std;
    
    int main()
    {
        
        int a;
        cin >> a;
        string name[a];
        int score[a];
        int pingyi[a];
        char ganbu[a];
        char xibu[a];
        int lunwen[a];
        int money[a];
        int w = 0,maxmoney = 0,allmoney = 0;
        for(int i = 0;i < a;i++)
        {
            cin >> name[i] >> score[i] >> pingyi[i] >> ganbu[i] >> xibu[i] >> lunwen[i];
        }
        for(int i = 0;i < a;i++)
        {
            money[i] = 0;
            if(score[i] > 80 && lunwen[i] >= 1)
            {
                money[i] += 8000;
            }
            if(score[i] > 85 && pingyi[i] > 80)
            {
                money[i] += 4000;
            }
            if(score[i]> 90)
            {
                money[i] += 2000;
            }
            if(score[i] > 85 && xibu[i] == 'Y')
            {
                money[i] += 1000;
            }
            if(pingyi[i] > 80 && ganbu[i] == 'Y')
            {
                money[i] += 850;
            }
            allmoney += money[i]; 
        }
        for(int i = 0;i < a;i++)
        {
            if(maxmoney < money[i])
            {
                maxmoney = money[i];
                w = i;
            }
        }
        cout << name[w] << endl << maxmoney << endl << allmoney;
        return 0;
    }
    

    一道很不错的模拟题,祝大家全部AC
    最后吐槽一句:这是什么学校?发这么多奖学金?

  • 0
    @ 2019-07-23 21:42:39

    '''Python...'''
    x = int(input())
    tot = 0
    top = 0
    for i in range(x):
    y = input().split()
    mo = 0
    mo += 8000 if int(y[1]) > 80 and int(y[5]) > 0 else 0
    mo += 4000 if int(y[1]) > 85 and int(y[2]) > 80 else 0
    mo += 2000 if int(y[1]) > 90 else 0
    mo += 1000 if y[4] == 'Y' and int(y[1]) > 85 else 0
    mo += 850 if int(y[2]) > 80 and y[3] == 'Y' else 0
    tot += mo
    if top < mo:
    top = mo
    name = y[0]
    print(name)
    print(top)
    print(tot)

  • 0
    @ 2019-07-15 20:12:17

    #include<stdio.h>
    #include<math.h>
    #include<string.h>
    typedef struct{
    char name[20];
    int finalscore;
    int classscore;
    char bgb;
    char west;
    int essay;
    int money;
    }S;
    S student[10];
    int main()
    {
    int N,i,flag;
    long sum=0;
    int max=0;
    scanf("%d",&N);
    for(i=0;i<N;i++)
    {
    scanf("%s %d %d %c %c %d",student[i].name,&student[i].finalscore,&student[i].classscore,&student[i].bgb,&student[i].west,&student[i].essay);
    student[i].money=0;
    }
    for(i=0;i<N;i++)
    {
    if(student[i].finalscore>80&&student[i].essay)
    student[i].money+=8000;
    if(student[i].finalscore>85&&student[i].classscore>80)
    student[i].money+=4000;
    if(student[i].finalscore>90)
    student[i].money+=2000;
    if(student[i].finalscore>85&&student[i].west=='Y')
    student[i].money+=1000;
    if(student[i].classscore>80&&student[i].bgb=='Y')
    student[i].money+=850;
    }
    for(i=0;i<N;i++)
    {
    sum+=student[i].money;
    }
    for(i=0;i<N;i++){
    if(max<student[i].money){
    max=student[i].money;
    flag=i;
    }
    }
    printf("%s\n",student[flag].name);
    printf("%d\n",student[flag].money);
    printf("%d",sum);
    return 0;
    }

  • 0
    @ 2019-06-19 15:59:31

    #include <iostream>
    #include <string>
    using namespace std;
    struct student {
    string name;
    int cj1;
    int cj2;
    int write;
    int money;
    }per[100];
    int main(void)
    {
    int all;
    int i = 0;
    int win = 0;
    unsigned long int all_money = 0;
    char a;
    cin >> all;
    while (i < all) {
    per[i].money = 0;
    cin >> per[i].name;
    cin >> per[i].cj1;
    cin >> per[i].cj2;
    cin >> a;
    if (a == 'Y'&&per[i].cj2 > 80)per[i].money += 850;
    cin >> a;
    if (a == 'Y'&&per[i].cj1 > 85)per[i].money += 1000;
    cin >> per[i].write;
    if (per[i].cj1 > 80 && per[i].write)per[i].money += 8000;
    if (per[i].cj1 > 85 && per[i].cj2 > 80)per[i].money += 4000;
    if (per[i].cj1 > 90)per[i].money += 2000;
    ++i;
    }
    for (i = 0; i < all; ++i) {
    if (per[win].money < per[i].money)win = i;
    all_money += per[i].money;
    }
    cout << per[win].name << endl << per[win].money << endl << all_money;
    return 0;
    }

  • 0
    @ 2019-06-12 20:38:10

    按题意判断即可~
    cpp
    #include <iostream>
    #include <string>
    using namespace std;
    int main()
    {
    string name[101];
    int qimo[101],banji[101];
    char xuesheng[101],xibu[101];
    int lunwen[101];
    int n,ans=0;
    int money;
    int max1=-1;
    string maxstudent;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
    money=0;
    cin>>name[i]>>qimo[i]>>banji[i]>>xuesheng[i]>>xibu[i]>>lunwen[i];
    if(qimo[i]>80 && lunwen[i]>=1) money+=8000;
    if(qimo[i]>85 && banji[i]>80) money+=4000;
    if(qimo[i]>90) money+=2000;
    if(qimo[i]>85 && xibu[i]=='Y') money+=1000;
    if(banji[i]>80 && xuesheng[i]=='Y') money+=850;
    ans+=money;
    if(money>max1)
    {
    max1=money;
    maxstudent=name[i];
    }
    }
    cout<<maxstudent<<endl<<max1<<endl<<ans;
    return 0;
    }

  • 0
    @ 2019-06-06 10:36:58
    #include <iostream>
    #include <algorithm>
    using namespace std;
    struct Student{
        string name;
        int endTermScore;
        int classScore;
        bool isCadre;
        bool isWestern;
        int thesisNum;
        int num;
        int scholarship;
        Student(){}
        Student(string na, int es, int cs, char ic, char iw, int tn, int n){
            name = na;
            endTermScore = es;
            classScore = cs;
            isCadre = (ic == 'Y');
            isWestern = (iw == 'Y');
            thesisNum = tn;
            num = n;
            scholarship = 0;
        }
    };
    typedef Student* sp;
    sp students[100];
    int n;
    int sum;
    bool cmp(const sp a, const sp b){
        return a->scholarship == b->scholarship ? a->num < b->num : a->scholarship > b->scholarship;
    }
    void countScholarship(){
        for(int i = 0; i < n; i++){
            sp k = students[i];
            //院士奖学金
            if(k->endTermScore > 80 && k->thesisNum >= 1)
                k->scholarship += 8000;
            
            //五四奖学金
            if(k->endTermScore > 85 && k->classScore > 80)
                k->scholarship += 4000;
            
            //成绩优秀奖
            if(k->endTermScore > 90)
                k->scholarship += 2000;
            
            //西部奖学金
            if(k->endTermScore > 85 && k->isWestern)
                k->scholarship += 1000;
            
            //班级贡献奖
            if(k->classScore > 80 && k->isCadre)
                k->scholarship += 850;
    
            sum += k->scholarship;
        }
    
        sort(students, students + n, cmp);
        return ;
    }
    int main(){
        string na;
        int es, cs, tn;
        char ic, iw;
        cin >> n;
        cin.ignore();
        for(int i = 0; i < n; i++){
            cin >> na >> es >> cs >> ic >> iw >> tn;
            students[i] = new Student(na, es, cs, ic, iw, tn, i); 
        }
        countScholarship();
        cout << students[0]->name << endl;
        cout << students[0]->scholarship << endl;
        cout << sum << endl;
        return 0;
    }
    
    
  • 0
    @ 2019-06-05 21:59:59
    #include <iostream>
    #include <algorithm>
    #include <cstring>
    #include <string>
    #include <cstdio>
    #include <cmath>
    using namespace std;
    const int N = 110;
    struct code
    {
        string name,work,west;
        int end_mark,class_mark,sum,ans;
    }a[N];
    string high_name;
    int n;
    int ans = 0,all_ans = 0;
    int main()
    {
        cin >> n;
        for(int i = 0; i < n; i++)
        {
            cin >> a[i].name >> a[i].end_mark >> a[i].class_mark >> a[i].work >> a[i].west >> a[i].sum;
            if(a[i].end_mark > 80 && a[i].sum >= 1) a[i].ans += 8000;
            if(a[i].end_mark > 85 && a[i].class_mark > 80)  a[i].ans += 4000;
            if(a[i].end_mark > 90)  a[i].ans += 2000;
            if(a[i].end_mark > 85 && a[i].west == "Y")  a[i].ans += 1000;
            if(a[i].class_mark > 80 && a[i].work == "Y")    a[i].ans += 850;
            if(a[i].ans > ans)
            {
                high_name = a[i].name;
                ans = a[i].ans;
            }
        }
        for(int i = 0; i < n; i++)
        {
            all_ans += a[i].ans;
        }
        cout << high_name << endl << ans << endl << all_ans << endl;
        return 0;
    }
    
  • 0
    @ 2019-05-12 16:15:48

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<string>
    #include<algorithm>
    #include<cmath>
    using namespace std;
    struct node{
    string xm;
    int qm,bj;
    char bgb,xb;
    int lw;
    int ans;
    int sum;
    }a[101];
    int n,tot=0;
    bool cmp(node x,node y)
    {
    if(x.ans==y.ans)return x.sum<y.sum;
    else return x.ans>y.ans;
    }
    int main()
    {
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
    cin>>a[i].xm>>a[i].qm>>a[i].bj>>a[i].bgb>>a[i].xb>>a[i].lw;
    if(a[i].qm>80&&a[i].lw>=1)a[i].ans+=8000;
    if(a[i].qm>85&&a[i].bj>80)a[i].ans+=4000;
    if(a[i].qm>90)a[i].ans+=2000;
    if(a[i].xb=='Y'&&a[i].qm>85)a[i].ans+=1000;
    if(a[i].bj>80&&a[i].bgb=='Y')a[i].ans+=850;
    a[i].sum=i;
    tot+=a[i].ans;
    }
    sort(a+1,a+n+1,cmp);
    cout<<a[1].xm<<endl<<a[1].ans<<endl<<tot;
    return 0;
    }

  • 0
    @ 2019-03-26 16:34:36

    c的题解:

    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    typedef struct stu
    {
        char name[20];
        int final_grade;
        int banji_grade;
        char ganbu;
        char west;
        int lunwen;
        struct stu *next;
    }stu;
    
    int main(int argc, const char * argv[]) {
        int n,i=0;//个数
        int maxsum=0;
        int sum=0;
        char name1[20];
        scanf("%d",&n);
        while(i<n)
        {
            int s=0;
            stu *stu1 = malloc(sizeof(stu));
            scanf("%s",stu1->name);
            scanf("%d",&stu1->final_grade);
            scanf("%d",&stu1->banji_grade);
            scanf(" %c %c",&stu1->ganbu,&stu1->west);
            scanf("%d",&stu1->lunwen);
            if(stu1->final_grade>80 && stu1->lunwen>=1)
                s+=8000;
            if(stu1->final_grade>85 && stu1->banji_grade>80)
                s+=4000;
            if(stu1->final_grade>90)
                s+=2000;
            if(stu1->final_grade>85 &&stu1->west=='Y')
                s+=1000;
            if(stu1->ganbu=='Y' && stu1->banji_grade>80)
                s+=850;
            
            sum+=s;
            if(s>maxsum)
            {
                strcpy(name1,stu1->name);
                maxsum=s;
            }
            stu1 = stu1->next;
            i++;
            }
        printf("%s\n%d\n%d",name1, maxsum, sum);
        return 0;
    }
    
    
    
  • 0
    @ 2019-02-19 15:20:19

    第二次写题解~dalao不要见笑,刚学半年的菜鸟,结构体即可
    上代码:
    #include<iostream>
    #include<cstring>
    #include<string>
    #include<cmath>
    using namespace std;
    struct p
    {
    string n;
    int qimo,pingyi;
    char xibu,ganbu;
    int lunwen;
    long s=0;
    };struct p a[101];
    int main()
    {
    int i,j,n,max=0;
    long long he=0;
    string answer;
    cin>>n;
    for(i=1;i<=n;i++)
    {
    cin>>a[i].n>>a[i].qimo>>a[i].pingyi>>a[i].ganbu>>a[i].xibu>>a[i].lunwen;
    if(a[i].qimo>80 and a[i].lunwen>=1)
    a[i].s+=8000;
    if(a[i].qimo>85 and a[i].pingyi>80)
    a[i].s+=4000;
    if(a[i].qimo>90)
    a[i].s+=2000;
    if(a[i].qimo>85 and a[i].xibu=='Y')
    a[i].s+=1000;
    if(a[i].pingyi>80 and a[i].ganbu=='Y')
    a[i].s+=850;
    he+=a[i].s;
    }
    for(i=1;i<n;i++)
    {
    for(j=i+1;j<n;j++)
    {
    if(a[i].s<a[j].s)
    swap(a[i],a[j]);
    }
    }
    cout<<a[1].n<<endl;
    cout<<a[1].s<<endl;
    cout<<he;
    return 0;
    }

    • @ 2019-02-19 19:05:34

      写的好棒,大赞!!!厉害了我的张
      !!!

    • @ 2019-03-11 09:59:33

      @
      cindy201902
      厉害了我的欧阳

  • 0
    @ 2019-01-25 21:43:44

    #include <stdio.h>
    #include<iostream>
    int n;
    const int Y = 1, N = 0, Maxn = 10001;
    using namespace std;
    struct student
    {
    char name;
    int grades1;
    int grades2;
    bool staff;
    bool west;
    int article;
    int prize = 0;
    }*p[Maxn];
    int main()
    {
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
    cin >> p[i]->name;
    cin >> p[i]->grades1;
    cin >> p[i]->grades2;
    cin >> p[i]->staff;
    cin >> p[i]->west;
    cin >> p[i]->article;
    if (p[i]->article >= 1 && p[i]->grades1>80)
    p[i]->prize += 8000;
    if (p[i]->grades1>85 && p[i]->grades2>80)
    p[i]->prize += 4000;
    if (p[i]->grades1>90)
    p[i]->prize += 2000;
    if (p[i]->grades1>85 && p[i]->west == Y)
    p[i]->prize += 1000;
    if (p[i]->grades2>80 && p[i]->staff == Y)
    p[i]->prize += 850;
    }
    for (int i = 1; i <= n; i++)
    if (p[i]->prize>p[0]->prize)
    p[0]->prize = p[i]->prize;
    cout << p[0]->prize << endl;
    return 0;

    }

信息

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