zoukankan      html  css  js  c++  java
  • HDOJ 2673 shǎ崽 OrOrOrOrz

    shǎ崽 OrOrOrOrz

    此题是用来膜拜的

    #include <iostream>

    #include <cstring>

    #include <algorithm>


    using namespace std;

    int a[11111];

    int b[11111];


    int main()

    {

        int n;

        while(cin>>n)

        {

        for(int i=0;i<n;i++)

        {

            cin>>a;

        }

        memset(b,0,sizeof(b));

        sort(a,a+n);

        int i=0;

        int j=n-1;

        int tot=0;

        while(i<=j)

        {

            if(b[j]!=1)

            {

            cout<<a[j];

            b[j]=1;j--;tot++;

            if(tot!=n) cout<<" ";

            }

            if(b!=1)

            {

            cout<<a;

            b=1;i++;tot++;

            if(tot!=n) cout<<" ";

            }

        }

        cout<<endl;

        }


        return 0;

    }

     



  • 相关阅读:
    Synchronized锁升级
    锁削除和锁粗化
    自旋锁
    Synchronized原理
    浅谈AQS原理
    JSON使用
    JSON语法
    Decode Ways
    String to Integer(atoi)
    Leetcode:Reverse Words in a String
  • 原文地址:https://www.cnblogs.com/CKboss/p/3351070.html
Copyright © 2011-2022 走看看