• <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>

            ArcTan

            dfs
            隨筆 - 16, 文章 - 117, 評論 - 6, 引用 - 0
            數據加載中……

            poj1694(單調棧-求矩形最大面積)

            今天就做做單調棧,挺好寫的。應該多了解了原理
            字符串讀入還是有問題啊,這個不行,得看清楚輸入后在寫!
            一次AC:
            #include<stdio.h>
            #include
            <string.h>
            #include
            <math.h>
            int n,m,ans;
            int a[1005],stack[1005],pos[1005];
            int GetAns()
            {
                
            int i,top;
                top
            =0;
                stack[
            0]=pos[0]=0;
                
            for (i=1;i<=n ;i++ )
                {
                    
            while (top>0&&a[i]<=stack[top])
                    {
                        
            if (ans<(i-1-pos[top-1])*stack[top])
                            ans
            =(i-1-pos[top-1])*stack[top];
                        top
            --;
                    }
                    top
            ++;
                    stack[top]
            =a[i];
                    pos[top]
            =i;
                }
                
            while (top>0)
                {
                    
            if (ans<(n-pos[top-1])*stack[top])
                        ans
            =(n-pos[top-1])*stack[top];
                    top
            --;
                }
            }
            int main()
            {
                
            int cas,i,j;
                
            char ch[2];
                scanf(
            "%d",&cas);
                
            while (cas--)
                {
                    memset(a,
            0,sizeof(a));
                    ans
            =0;
                    scanf(
            "%d%d",&m,&n);
                    
            for (i=0;i<m ;i++ )
                    {
                        
            for (j=1;j<=n ;j++ )
                        {
                            scanf(
            "%s",&ch);
                            
            if (ch[0]=='F')
                                a[j]
            ++;
                            
            else
                                a[j]
            =0;
                        }
                        GetAns();
                    }
                    printf(
            "%d\n",3*ans);
                }
                
            return 0;
            }
            加油啊,加油!

            posted on 2012-04-24 15:32 wangs 閱讀(383) 評論(0)  編輯 收藏 引用 所屬分類: ACM-數據結構

            av国内精品久久久久影院| 久久精品这里只有精99品| 一本一道久久综合狠狠老| 色偷偷88888欧美精品久久久| 久久久亚洲欧洲日产国码二区| 成人免费网站久久久| 久久99亚洲综合精品首页| 蜜桃麻豆WWW久久囤产精品| 国产精品99久久99久久久| 久久99久久无码毛片一区二区| 97精品依人久久久大香线蕉97| 国产精品热久久毛片| 色狠狠久久AV五月综合| 99久久婷婷国产一区二区| 国产69精品久久久久久人妻精品| 99久久99久久精品免费看蜜桃| 中文字幕久久精品 | 99久久这里只精品国产免费| 国产V综合V亚洲欧美久久| 伊人久久大香线蕉AV一区二区| 狠狠色丁香久久婷婷综| 午夜久久久久久禁播电影| 久久国产视频99电影| 成人国内精品久久久久影院VR| 中文无码久久精品| 97精品伊人久久大香线蕉| 久久天天躁狠狠躁夜夜不卡| 一本一道久久精品综合| 久久精品国产影库免费看| 国产精品美女久久久m| 国产精品久久久久无码av| 日韩av无码久久精品免费| 亚洲va久久久噜噜噜久久狠狠| 99久久综合国产精品免费| 久久AV高潮AV无码AV| 日韩欧美亚洲综合久久| 成人久久免费网站| 久久午夜无码鲁丝片| 久久91精品久久91综合| 国产成人综合久久精品尤物| 品成人欧美大片久久国产欧美 |