84分求助

P1104 生日

lj2013 @ 2025-01-02 14:41:49

#include <bits/stdc++.h>

using namespace std;

#define ll long long

struct stNode
{
    string sA;
    ll llN;
    ll llY;
    ll llR;
    ll llNum;
};

stNode stA[105];
ll llN = 0;

int main()
{
    scanf("%lld", &llN);

    for (ll i = 1; i <= llN; i++)
    {
        stA[i].llNum = i;

        cin >> stA[i].sA;

        scanf("%lld%lld%lld", &stA[i].llN, &stA[i].llY,
        &stA[i].llR);
    }

    for (ll i = 1; i <= llN; i++)
    {
        ll llT = i;
        ll llMin = (stA[i].llN * 1000 + stA[i].llY * 50 + stA[i].llR);

        for (ll j = i + 1; j <= llN; j++)
        {
            ll llMin2 = llMin;

            if ((stA[j].llN * 1000 + stA[j].llY * 50 + stA[j].llR) == llMin)
            {
                llMin = (stA[j].llN * 1000 + stA[j].llY * 50 + stA[j].llR) + 
                stA[j].llNum;
            }
            else
            {
                llMin = min((stA[j].llN * 1000 + stA[j].llY * 50 + stA[j].llR), 
                llMin);
            }

            if (llMin != llMin2)
            {
                llT = j;
            }
        }

        swap(stA[i], stA[llT]);
    }

    for (ll i = 1; i <= llN;i++)
    {
        printf("%s\n", stA[i].sA.c_str());
    }

    return 0;
}

/*
91
Zhaojiang 1991 1 8
Yangchu 1993 1 7
Kangyi 1993 2 9
Wangxing 1992 10 20
Liyue 1991 3 14
Qianmu 1993 1 2
Sunxian 1994 5 7
Liyue 1994 10 10
Devon 1988 1 1
Lindsay 1988 1 2
Guning 1989 12 30
Hanmei 1994 1 1
Songting 1992 6 12
Guofan 1994 5 5
Yangyu 1991 9 13
Columbia 1988 2 1 
Ainey 1988 2 2
Averill 1989 2 3
Bronson 1990 2 3
Corliss 1991 3 1
Lari 1991 3 2
Ballard 1992 8 20
Brown 1994 1 17
Courtney 1989 10 17
Lark 1990 6 5
Bancroft 1988 1 10
Buck 1988 9 10
Daralis 1992 9 10
Leigh 1993 9 10
Barclay 1988 11 10
Buckley 1989 11 10
Dawn 1990 11 10
Qiujingya 1990 5 8
Luowen 1990 4 6
Heling 1990 12 11
Luopeng 1992 1 9
Pengwei 1993 2 3
Mating 1992 1 18
Chenya 1990 4 5
Tantian 1989 9 2
Leslie 1991 11 10
Barden 1992 11 10
Bud 1993 11 10
Demelza 1994 11 10
Liberty 1989 11 9
Barnett 1988 11 9
Burgess 1992 11 9
Maliang 1990 1 2
Wangxin 1992 12 3
Pangcheng 1990 7 28
Lingshuai 1991 2 9
Xiebing 1991 11 10
Yangyang 1991 3 20
Shejing 1993 9 30
Yuanhui 1992 3 3
Liufang 1993 3 30
Ansley 1993 11 9
Brishen 1994 11 9
Chelsea 1988 7 27
Kirsten 1990 7 27
Atherol 1991 7 27
Brock 1989 7 27
Claiborne 1992 7 27
Kismet 1993 7 24
Atwater 1994 7 24
Broderick 1990 2 14
Clovis 1991 3 13
Kyla 1990 1 19
Twood 1991 1 19
Bromley 1992 1 19
Micheal 1988 2 28
Mich 1989 2 28
Richer 1990 2 27
Ownes 1991 2 27
Shouler 1992 12 10
Akai 1993 12 10
Pardo 1994 12 10
Surse 1989 12 10
Tia 1988 12 10
Laise 1988 4 4
Yila 1989 4 4
Mcial 1990 4 4
Nipa 1991 4 4
Bedge 1992 4 4
Colece 1993 4 4
Zipoe 1994 4 4
Geman 1988 6 30
Locuy 1989 6 30
Kacue 1990 6 30
Vocae 1992 6 30
Huafer 1993 6 30
*/

by lj2013 @ 2025-01-02 14:44:14

当时我写错了,应该是80分求助。


|