1 条题解

  • 0
    @ 2025-10-05 21:38:55

    链接

    制造(oi00006)


    AC代码:

    #include<bits/stdc++.h>
    using namespace std;
    struct tj
    {
        string xm;
        int nl;
        string gj;
    }tj[10000];
    int main()
    {
        int a,b,c,d,e,f,g;
        cin>>a;
        for(b=1;b<=a;b=b+1)
        {
            cin>>tj[b].xm>>tj[b].nl>>tj[b].gj;
        }
        for(b=1;b<=a-1;b=b+1)
        {
            for(c=b+1;c<=a;c=c+1)
            {
                if(tj[b].gj>tj[c].gj)
                {
                    swap(tj[b],tj[c]);
                }
                if(tj[b].gj==tj[c].gj && tj[b].nl>tj[c].nl)
                {
                    swap(tj[b],tj[c]);
                }
                if(tj[b].gj==tj[c].gj && tj[b].nl==tj[c].nl && tj[b].xm>tj[c].xm)
                {
                    swap(tj[b],tj[c]);
                }
            }
        }
        for(b=1;b<=a;b=b+1)
        {
            if(b/10<1)
            {
                cout<<"0000"<<b;
            }
            else if(b/10>=1 && b/10<10)
            {
                cout<<"000"<<b;
            }
            else if(b/10>=10 && b/10<100)
            {
                cout<<"00"<<b;
            }
            else if(b/10>=100 && b/10<1000)
            {
        
                cout<<"0"<<b;
            }
            else if(b/10>=1000 && b/10<10000)
            {
                cout<<b;
            }
            cout<<" "<<tj[b].xm<<" "<<tj[b].nl<<" "<<tj[b].gj<<endl;
        }
    }
    
  • 1

信息

ID
1006
难度
9
分类
(无)
标签
(无)
递交数
7
已通过
1
通过率
14%
上传者