zoukankan      html  css  js  c++  java
  • HDUOJ Clear All of Them I 状压DP

    Clear All of Them I

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 122768/62768 K (Java/Others)
    Total Submission(s): 1455    Accepted Submission(s): 484


    Problem Description
    Acmers have been the Earth Protector against the evil enemy for a long time, now it’s your turn to protect our home.
      There are 2 * n enemies in the map. Your task is to clear all of them with your super laser gun at the fixed position (x, y).
      For each laser shot, your laser beam can reflect 1 times (must be 1 times), which means it can kill 2 enemies at one time. And the energy this shot costs is the total length of the laser path.
      For example, if you are at (0, 0), and use one laser shot kills the 2 enemies in the order of (3, 4), (6, 0), then the energy this shot costs is 5.0 + 5.0 = 10. 00.
      Since there are 2 * n enemies, you have to shot n times to clear all of them. For each shot, it is you that select two existed enemies and decide the reflect order.
      Now, telling you your position and the 2n enemies’ position, to save the energy, can you tell me how much energy you need at least to clear all of them?
      Note that:
       > Each enemy can only be attacked once.
       > All the positions will be unique.
       > You must attack 2 different enemies in one shot.
       > You can’t change your position.
     
    Input
    The first line contains a single positive integer T( T <= 100 ), indicates the number of test cases.
    For each case:
      There are 2 integers x and y in the first line, which means your position.
      The second line is an integer n(1 <= n <= 10), denote there are 2n enemies.
      Then there following 2n lines, each line have 2 integers denote the position of an enemy.
      
      All the position integers are between -1000 and 1000.
     
    Output
    For each test case: output the case number as shown and then print a decimal v, which is the energy you need at least to clear all of them (round to 2 decimal places).
     
    Sample Input
    2 0 0 1 6 0 3 0 0 0 2 1 0 2 1 -1 0 -2 0
     
    Sample Output
    Case #1: 6.00 Case #2: 4.41
     
    Source
     
     
    网上给这道题的定义为状压DP优化,但我实在看不出哪儿有优化的意义,然后,我就TLE了。
    by mhy12345(http://www.cnblogs.com/mhy12345/) 未经允许请勿转载

    本博客已停用,新博客地址:http://mhy12345.xyz

  • 相关阅读:
    dedecms代码研究五
    dedecms代码研究四
    判断有没有真正点击打印
    SAP中删除假脱机请求
    商品扩地点不成功
    记录一些使用的abap小程序帮助开发
    sap abap 程序 中使用 FTP . <转载>
    SM37 后台调试
    ftp上传下载| 图片上传下载
    ALV调用的几个标准函数 <转自 思微随想>
  • 原文地址:https://www.cnblogs.com/mhy12345/p/3866442.html
Copyright © 2011-2022 走看看