好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

BestCoderRound#11(Div.2)_html/css_WEB-ITnose

太菜,只能去Div2.(都做不完 ORZ。。。

还有这。


#include #include #include #include #include#include #include #include #include #include #include #include #define INF 0x7fffffff#define eps 1e-8#define LL long long#define PI 3.141592654#define CLR(a,b) memset(a,b,sizeof(a))#define FOR(i,a,b) for(int i= a;i =b ;i--)#define debug puts("==fuck==")#define acfun std::ios::sync_with_stdio(false)#define SIZE 20+10using namespace std;int a[10],n;bool cmp(int a,int b){    return a>b;}int num[101];bool outflag;void dfs(int m){    if(outflag)return;    if(m==n)    {        if(num[m-1]&1)        {            FOR(j,0,n)            printf("%d",num[j]);            printf("\n");            outflag=1;        }        else        return;    }    FOR0(j,9,0)    {        if(a[j])        {            a[j]--;            num[m]=j;            dfs(m+1);            a[j]++;        }    }}int main(){    while(~scanf("%d",&n))    {        bool flag=0;        int odd=0;        int even=0;        CLR(a,0);        outflag=0;        FOR(i,0,n)        {            int tmp;            scanf("%d",&tmp);            if(tmp&1)flag=1;            a[tmp]++;            if(tmp&1)odd++;            else if(tmp!=0)even++;        }        if(!flag||(n!=1&&odd==1&&even==0))        {            puts("-1");            continue;        }        dfs(0);    }} 


# 1003 知道是维护一个数列。时间复杂度是O(n)的。

ORZ,写了半天,还是没写出来,这周慢慢写吧,先挂这。

#

wait...

#



# 1004 我用线段树的,结果MLE。卡内存有意思?

有人说可以试试 unsigned short 看能不能过。

慢慢交吧。反正在HDU41页。


#

wait...

#

查看更多关于BestCoderRound#11(Div.2)_html/css_WEB-ITnose的详细内容...

  阅读:36次