美文网首页
无标题文章

无标题文章

作者: lxp1055 | 来源:发表于2017-04-23 20:33 被阅读0次
#德分
#include<iostream>
using namespace std;
struct fen
{
    int zhun;
    int de;
    int cai;
    int zong;
};
void pai(fen f[],int e)
{
    int i,j;
    fen f5;
    for (i = 0; i < e; i++)
    {
        for (j = i + 1; j < e; j++)
        {
            if (f[i].zong <f[j].zong)
            {
                f5 = f[i];
                f[i] = f[j];
                f[j] = f5;
            }
             if (f[i].zong == f[j].zong)
            {
                if (f[i].de< f[j].de)
                {
                    f5 = f[i];
                    f[i] = f[j];
                    f[j] = f5;
                }
                else
                {
                    if (f[i].de==f[j].de)
                    {
                        if (f[i].zhun > f[j].zhun)
                        {
                            f5 = f[i];
                            f[i] = f[j];
                            f[j] = f5;
                        }
                    }
                }
            }
        }
    }
    for (i = 0; i < e; i++)
        cout << f[i].zhun << " " << f[i].de << " " << f[i].cai<<endl;
}
int main()
{
    fen f1[100], f2[100], f3[100],f4[100];
    int n, l, h;
    int sum=0;
    cin >> n >> l >> h;
    int s=0, y=0, u=0, p=0;
    for (int i = 0; i < n;i++)
    {
        int z, d, c;
        cin >> z >> d >> c;
        if (d >= l&&c >= l)
        {
            sum++;
            if (d >= h&&c >= h)
            {
                f1[s].zhun = z;
                f1[s].de = d;
                f1[s].cai = c;
                f1[s].zong = d + c;
                s++;
            }
            else if (d >= h&&c < h)
            {
                f2[y].zhun = z;
                f2[y].de = d;
                f2[y].cai = c;
                f2[y].zong = d + c;
                y++;
            }
            else if (d < h&&c < h&&c <= d)
            {
                f3[u].zhun = z;
                f3[u].de = d;
                f3[u].cai = c;
                f3[u].zong = d + c;
                u++;
            }
            else
            {
                f4[p].zhun = z;
                f4[p].de = d;
                f4[p].cai = c;
                f4[p].zong = d + c;
                p++;
            }
        }
    }
    cout << sum<<endl;
    if(s!=0)
      pai(f1,s);
    if(y!=0)
      pai(f2,y);
    if(u!=0)
      pai(f3,u);
    if(p!=0)
      pai(f4, p);
    system("PAUSE");
    return 0;
}

相关文章

  • 无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章 无标题文章无标题文章无标题文章无...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • fasfsdfdf

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标...

  • 无标题文章

    无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章无标题文章

  • 无标题文章

    无标题文章 无标题文章 无标题文章无标题文章 无标题文章 无标题文章

网友评论

      本文标题:无标题文章

      本文链接:https://www.haomeiwen.com/subject/befdzttx.html