• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆-65  評論-6  文章-0  trackbacks-0
             1 #include<stdio.h>
             2 #include<string.h>
             3 #include <math.h>
             4 #define MAXSIZE 502
             5 struct node {
             6     int num;//對應(yīng)數(shù)字
             7     int big;//原序列中比該數(shù)字大的數(shù)字的數(shù)目
             8 };
             9 node num[MAXSIZE];
            10 int t;//數(shù)組長度
            11 inline void scan(int &x){
            12     char ch;
            13     while(ch=getchar(),ch<'0'||ch>'9');x=ch-'0';
            14     while(ch=getchar(),ch>='0'&&ch<='9')x=10*x+ch-'0';
            15 }
            16 void MergeSort(int low,int len,int high){
            17     int border=low+len;
            18     while (low<border){
            19         int i,pos=low;
            20         node temp;
            21         if(num[pos].big>0){        
            22             for(i=border;i<=high&&num[pos].big>0;i++){
            23                 if(num[pos].num<num[i].num){
            24                     temp=num[pos];
            25                     num[pos]=num[i];
            26                     num[i]=temp;
            27                     pos=i;
            28                     num[pos].big--;
            29                 }
            30             }
            31         }
            32         low++;
            33     }
            34 }
            35 void Merge(int low,int high){
            36     if(low<high){
            37         int mid=(int)ceil((low+high+1)/2.0);
            38         Merge(low,mid-1);
            39         Merge(mid,high);
            40         MergeSort(low,(int)ceil((high-low+1)/2.0),high);
            41     }
            42 }
            43 
            44 int main(){
            45     #ifndef ONLINE_JUDGE
            46     freopen("in.txt","r",stdin);
            47     #endif 
            48     while (true){
            49         scan(t);
            50         if (t==0)
            51             break;
            52         int i;
            53         for(i=0;i<t;i++){
            54             scan(num[i].big);
            55             num[i].num=i+1;
            56         }
            57         Merge(0,t-1);
            58         printf("%d",num[0].num);
            59         for(i=1;i<t;i++)
            60             printf(",%d",num[i].num);
            61         printf("\n");
            62     }
            63     return 0;
            64 }
            65 
            posted on 2012-05-17 08:30 Leo.W 閱讀(170) 評論(0)  編輯 收藏 引用

            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            精品一区二区久久| 久久久久久国产精品美女| 亚洲日本va中文字幕久久| 亚洲精品蜜桃久久久久久| 浪潮AV色综合久久天堂| 99久久国产综合精品成人影院| 久久久久99精品成人片牛牛影视| 欧美亚洲国产精品久久高清| 91性高湖久久久久| 一本一道久久综合狠狠老| 国产免费福利体检区久久| 精品熟女少妇a∨免费久久| 久久伊人色| 99久久99久久精品国产| 热re99久久精品国99热| 久久久久亚洲精品无码网址| 国产精品一久久香蕉产线看| 欧美激情一区二区久久久| 91久久福利国产成人精品| 777米奇久久最新地址| 99久久99久久精品国产片果冻| 久久久久久国产a免费观看不卡| 久久精品成人免费看| 国产精品久久久久AV福利动漫| 久久精品国产免费观看| 久久综合日本熟妇| 久久久久亚洲AV综合波多野结衣| 久久99精品综合国产首页| 无码人妻久久一区二区三区免费| 欧美精品乱码99久久蜜桃| 久久久久亚洲AV片无码下载蜜桃| 久久青青国产| 午夜精品久久久久久久无码| 久久夜色撩人精品国产| 欧美午夜A∨大片久久| 亚洲精品无码久久不卡| 欧美亚洲国产精品久久| 青青草原综合久久大伊人| 漂亮人妻被中出中文字幕久久| 久久精品国产男包| 国产精品岛国久久久久|