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

            zoj3647

            像我這種弱比,十一不能回家,中秋不能回家的弱比,才會在這里默默的刷題,我擦

            昨天zoj月賽,坑死爹了


            ZOJ Problem Set - 3647
            Gao the Grid
            Time Limit: 2 Seconds Memory Limit: 65536 KB

            A n * m grid as follow:




            Count the number of triangles, three of whose vertice must be grid-points.
            Note that the three vertice of the triangle must not be in a line(the right picture is not a triangle).


            Input

            The input consists of several cases. Each case consists of two positive integers n and m (1 ≤ n, m ≤ 1000).
            Output

            For each case, output the total number of triangle.
            Sample Input
            1 1
            2 2
            Sample Output
            4
            76
            hint

            hint for 2nd case: C(9, 3) - 8 = 76


            yy出了想法,想法有些問題,還有搞的重復了好多

            然后今天看了woshi250hua大牛的解題報告,修改了代碼


            然后自認為沒錯了,還是一直wa,

            然后我就改了改輸出 %I64d  ->%lld 

            就過了,坑爹啊

            中秋節木有妹子陪,也木有月餅吃,哎。。。苦逼的日子


            #include <cstdio>
            #include 
            <cstdlib>
            #include 
            <cstring>
            #include 
            <cmath>
            #include 
            <ctime>
            #include 
            <cassert>
            #include 
            <iostream>
            #include 
            <sstream>
            #include 
            <fstream>
            #include 
            <map>
            #include 
            <set>
            #include 
            <vector>
            #include 
            <queue>
            #include 
            <algorithm>
            #include 
            <iomanip>
            #define maxn 1010
            #define LL long long
            using namespace std;
            LL f[maxn][maxn];
            LL num[maxn];
            LL totpoint,sum;
            LL n,m;
            int gcd(int a,int b)
            {
                
            if(b==0return a;
                
            else return gcd(b,a%b);
            }
            void work()
            {
                memset(num,
            0,sizeof(num));
                num[
            0]=num[1]=num[2]=0;
                
            for(int i=3; i<=1002; i++)
                    
            if(i-1&&i-2)
                        num[i] 
            = i * (i - 1* (i - 2/ 6;
            }
            int main()
            {
                memset(f,
            0,sizeof(f));
                
            for(int i=1; i<=1002; i++)
                {
                    
            for(int j=1; j<=1002; j++)
                        f[i][j]
            =gcd(i,j)-1;
                }
                work();
                
            while(scanf("%I64d%I64d",&n,&m)!=EOF)
                {

                    totpoint
            = (n+1* (m+1);
                    sum 
            = totpoint * ( totpoint - 1 ) * (totpoint - 2/ 6 ;

                    sum 
            -= (m+1)*(num[n+1]);
                    sum 
            -= (n+1)*(num[m+1]);
                    
            for(int i=1;i<=n;i++)
                    
            for(int j=1;j<=m;j++)
                    {
                       sum 
            -=  f[i][j]*(n+1-i)*(m+1-j)*2;
                    }
                    printf(
            "%lld\n",sum);
                }
                
            return 0;
            }


            posted on 2012-09-30 09:42 jh818012 閱讀(165) 評論(0)  編輯 收藏 引用

            <2025年7月>
            293012345
            6789101112
            13141516171819
            20212223242526
            272829303112
            3456789

            導航

            統計

            常用鏈接

            留言簿

            文章檔案(85)

            搜索

            最新評論

            • 1.?re: poj1426
            • 我嚓,,輝哥,,居然搜到你的題解了
            • --season
            • 2.?re: poj3083
            • @王私江
              (8+i)&3 相當于是 取余3的意思 因為 3 的 二進制是 000011 和(8+i)
            • --游客
            • 3.?re: poj3414[未登錄]
            • @王私江
              0ms
            • --jh818012
            • 4.?re: poj3414
            • 200+行,跑了多少ms呢?我的130+行哦,你菜啦,哈哈。
            • --王私江
            • 5.?re: poj1426
            • 評論內容較長,點擊標題查看
            • --王私江
            日韩精品久久无码人妻中文字幕| 99久久精品这里只有精品| 久久影院午夜理论片无码| 久久人人爽人人澡人人高潮AV | 亚洲欧美日韩精品久久亚洲区 | 国产综合久久久久久鬼色| 激情五月综合综合久久69| 久久九九兔免费精品6| 免费观看久久精彩视频| 一本色道久久综合亚洲精品| 亚洲国产精品久久久久网站| 久久经典免费视频| 国产精品久久免费| 中文字幕无码免费久久| 欧美久久一级内射wwwwww.| 麻豆精品久久久一区二区| 性色欲网站人妻丰满中文久久不卡| 久久精品国内一区二区三区| 亚洲国产精品无码久久SM| 人妻无码精品久久亚瑟影视| 91久久成人免费| 99久久久精品| 精品久久久久久成人AV| 久久人爽人人爽人人片AV| 麻豆av久久av盛宴av| 欧美久久久久久精选9999| 久久精品国产99国产精品| 久久噜噜电影你懂的| 精品熟女少妇a∨免费久久| 天天躁日日躁狠狠久久| 亚洲AV无码一区东京热久久| 久久丫忘忧草产品| 久久www免费人成看片| 久久天天躁夜夜躁狠狠躁2022| 色诱久久av| 久久久久久久波多野结衣高潮| 亚洲美日韩Av中文字幕无码久久久妻妇 | 99精品国产综合久久久久五月天| 亚洲精品无码久久不卡| 狠狠色噜噜色狠狠狠综合久久| 伊人久久久AV老熟妇色|