欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

[UVA] 10167 - Birthday Cake

系統 1652 0
? Problem G. Birthday Cake ?

?

Background

Lucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them.Now we put the cake onto a Descartes coordinate. Its center is at (0,0), and the cake's length of radius is 100.

There are 2N (N is a integer, 1<=N<=50) cherries on the cake. Mother wants to cut the cake into two halves with a knife (of course a beeline). The twins would like to be treated fairly, that means, the shape of the two halves must be the same (that means the beeline must go through the center of the cake) , and each half must have N cherrie(s). Can you help her?

Note: the coordinate of a cherry (x , y) are two integers. You must give the line as form two integers A,B(stands for Ax+By=0), each number in the range [-500,500]. Cherries are not allowed lying on the beeline. For each dataset there is at least one solution.

Input

The input file contains several scenarios. Each of them consists of 2 parts: The first part consists of a line with a number N, the second part consists of 2N lines, each line has two number, meaning (x,y) .There is only one space between two border numbers. The input file is ended with N=0.

Output

For each scenario, print a line containing two numbers A and B. There should be a space between them. If there are many solutions, you can only print one of them.

Sample Input

?

    2

-20 20

-30 20

-10 -50

10 -5

0
  

Sample Output

    0 1
    

題解:暴力枚舉+線性規劃。A、B都是整數且范圍為[-500,500],1<=N<=50,所以暴力枚舉即可。統計一下直線一側點的數目是否為N。注意有點在直線上的情況是不合法的。

代碼:
      
         1
      
       #include<stdio.h>


      
         2
      
       #include<
      
        string
      
      .h>


      
         3
      
       #include<stdbool.h>


      
         4
      
      
         5
      
      
        int
      
      
         i,j,n,m,sum,


      
      
         6
      
           a[
      
        110
      
      ],b[
      
        110
      
      
        ];


      
      
         7
      
      
         8
      
      
        int
      
      
         9
      
      
        init()


      
      
        10
      
      
        {


      
      
        11
      
      
        int
      
      
         i;


      
      
        12
      
           m=
      
        2
      
      *
      
        n;


      
      
        13
      
      
        for
      
      (i=
      
        1
      
      ;i<=m;i++
      
        )


      
      
        14
      
           scanf(
      
        "
      
      
        %d%d
      
      
        "
      
      ,&a[i],&
      
        b[i]);


      
      
        15
      
      
        16
      
      
        return
      
      
        0
      
      
        ;


      
      
        17
      
      
        }


      
      
        18
      
      
        19
      
      
        int
      
      
        20
      
      
        main()


      
      
        21
      
      
        {


      
      
        22
      
      
        int
      
      
         i,j,k,f;


      
      
        23
      
      
        while
      
      (
      
        true
      
      
        )


      
      
        24
      
      
            {


      
      
        25
      
               scanf(
      
        "
      
      
        %d
      
      
        "
      
      ,&
      
        n);


      
      
        26
      
      
        if
      
      (n==
      
        0
      
      ) 
      
        break
      
      
        ;


      
      
        27
      
      
                init();


      
      
        28
      
               f=
      
        0
      
      
        ;


      
      
        29
      
      
        for
      
      (i=-
      
        500
      
      ;i<=
      
        500
      
      ;i++
      
        )


      
      
        30
      
      
                {


      
      
        31
      
      
        for
      
      (j=-
      
        500
      
      ;j<=
      
        500
      
      ;j++
      
        )


      
      
        32
      
      
                    {


      
      
        33
      
                        sum=
      
        0
      
      
        ;


      
      
        34
      
      
        for
      
      (k=
      
        1
      
      ;k<=m;k++
      
        )


      
      
        35
      
      
                        {


      
      
        36
      
      
        if
      
      ((i*a[k]+j*b[k])<
      
        0
      
      ) sum++
      
        ;


      
      
        37
      
      
        if
      
      ((i*a[k]+j*b[k])==
      
        0
      
      ) 
      
        break
      
      
        ;


      
      
        38
      
      
                        }


      
      
        39
      
      
        if
      
      (sum==
      
        n)


      
      
        40
      
      
                        {


      
      
        41
      
                            f=
      
        1
      
      
        ;


      
      
        42
      
                            printf(
      
        "
      
      
        %d %d\n
      
      
        "
      
      
        ,i,j);


      
      
        43
      
      
        break
      
      
        ;


      
      
        44
      
      
                         }


      
      
        45
      
      
                     }


      
      
        46
      
      
        if
      
      (f==
      
        1
      
      ) 
      
        break
      
      
        ;


      
      
        47
      
      
                 }


      
      
        48
      
      
            }


      
      
        49
      
      
        50
      
      
        return
      
      
        0
      
      
        ;


      
      
        51
      
      
        }


      
      
        52
      
    

?

    
      
        ?
      
    
  

[UVA] 10167 - Birthday Cake


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 亚洲在线一区二区三区 | 亚洲黄网视频 | 色综合天天娱乐综合网 | 天天色综合影视 | 国产精品久久99 | 日韩欧美一区二区不卡 | 免费看毛片网 | 99国产精品自拍 | 国产精品一区二区在线观看 | 狠狠色噜噜狠狠狠狠黑人 | 日韩在线毛片 | 无遮挡一级毛片私人影院 | 电视剧知青1至45集免费观看 | 免费黄色av| 84pao视频强力打造免费视频 | 久久久免费的精品 | 久久女人被添全过程A片 | 久久久久国产精品免费免费搜索 | 国产亚洲精品久久久久久老妇小说 | 久久福利电影 | 国产自产在线 | 色综合久久综合欧美综合 | 一级片免费视频 | 激情小说色 | A片扒开双腿进入做视频 | 久久综合偷拍 | 久久久国产99久久国产首页 | 国产香蕉视频在线观看 | 亚洲国产一区二区视频 | 国产91网| 91在线视频观看 | 国产成人综合在线 | 久久精品综合电影 | 亚洲人成网站在线播放观看 | 精品久久久久不卡无毒 | 牛牛碰在线视频 | 日产中文字乱码卡一卡二视频 | 天堂精品 | 羞羞视频免费网站在线看 | 九九精品视频在线观看九九 | 精品亚洲福利一区二区 |