• <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>
            posts - 74,  comments - 33,  trackbacks - 0

            TimeLimit : 1 Second ? Memorylimit : 32 Megabyte ?

            Totalsubmit : 590 ? Accepted : 131

            Anti-terrorism is becoming more and more serious nowadays. The country now has n soldiers,and every solider has a score.

            We want to choose some soldiers to fulfill an urgent task. The soldiers chosen must be adjacent to each other in order to make sure that they can cooperate well. And all the soldiers chosen must have an average score greater than a.

            Now, please calculate how many ways can the chief of staff choose the soldiers.

            Input

            The first line consists of a single integer t, indicating number of test cases.

            For each test case, the first line gives n, the number of soldiers, and a, the minimum possible average score(n<=100000,a<=10000). The second line gives n integers, corresponding to the soldiers' scores in order. All the scores are no greater than 10000.

            Output

            An integer n, number of ways to choose the soldiers.

            Sample Input

            2
            5 3
            1 3 7 2 4
            1 1000
            9999

            Sample Output

            10
            1
            一個簡稱CS的題目其實找到規律的話就很簡單了,一個Mergersort就能AC;
            Mergersort代碼如下:
            void?Mergersort(INT?l,INT?r){
            ????INT?i,j,sign;
            ????
            if(l>=r)return?;
            ????INT?mid
            =(l+r)>>1;
            ????Mergersort(l,mid);
            ????Mergersort(mid
            +1,r);
            ????sign
            =l,i=l,j=mid+1;
            ????
            while(i<=mid&&j<=r){
            ????????
            if(score[j]>score[i]){
            ????????????all
            +=mid-i+1;
            ????????????now[sign
            ++]=score[j++];????
            ????????}

            ????????
            else?now[sign++]=score[i++];????????
            ????}

            ????
            while(i<=mid)now[sign++]=score[i++];
            ????
            while(j<=r)now[sign++]=score[j++];
            ????
            for(i=l;i<=r;i++)
            ????????score[i]
            =now[i];
            ????
            return?;
            }
            posted on 2009-02-21 20:13 KNIGHT 閱讀(158) 評論(0)  編輯 收藏 引用
            <2009年2月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            1234567

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久婷婷五月综合97色一本一本| 国产亚洲美女精品久久久| 国产精品久久久久蜜芽| 性高湖久久久久久久久| 91麻精品国产91久久久久| 伊人色综合九久久天天蜜桃| 无码人妻久久一区二区三区| 久久不射电影网| 中文字幕热久久久久久久| 91精品婷婷国产综合久久| 亚洲中文字幕无码久久精品1| 久久er热视频在这里精品| 久久久久亚洲精品日久生情| 国产成人久久精品区一区二区| 亚洲精品乱码久久久久久不卡| 国产成人久久精品区一区二区| 色老头网站久久网| 成人国内精品久久久久影院VR| 国产精品久久久久jk制服| 中文字幕无码av激情不卡久久| 狠狠色噜噜狠狠狠狠狠色综合久久| 久久无码高潮喷水| 久久99精品国产麻豆不卡| 丁香五月网久久综合| 亚洲AV日韩精品久久久久久| 久久精品极品盛宴观看| 四虎国产精品免费久久| 久久久久久久亚洲精品| 国产69精品久久久久99尤物| 亚洲成色999久久网站| 国产精品99精品久久免费| 伊人久久大香线蕉av一区| 97久久国产综合精品女不卡| 亚洲欧美一区二区三区久久| 香港aa三级久久三级老师2021国产三级精品三级在 | 无遮挡粉嫩小泬久久久久久久| 亚洲国产综合久久天堂| 一级做a爰片久久毛片毛片| 久久久久99精品成人片| 亚洲欧洲久久久精品| 久久久国产打桩机|