408. Game with points

Time limit per test: 0.25 second(s)
Memory limit: 65536
kilobytes
input: standard
output: standard

Recently Petya has discovered new game with points. Rules of the game are quite simple. First, there is only
one point A0 with coordinates (0, 0). Then Petya have to draw N another points. Points must be drawn
consequently and each new point must be connected with exactly one of the previous points by a segment.
Let's decribe the game process more formally. At the i-th step Petya chooses the position of the point Ai (not
necessarily with integer coordinates). Than he chooses one of the previously drawn points in order to connect it with the
point Ai. Lets call this point B. The following conditions must be held:

  • Point Ai must not coincide with any of the previous points.
  • Point Ai must not lie on the previously drawn segments.
  • Segment AiB must not have common points with previously drawn segments, except possibly the point B.
  • Segment AiB must not cover any of the previous points, except the point B.
  • Length of the segment AiB must not exceed 1. After drawing each point Petya computes two values.
  • The largest number of segments which share a common point.
  • The largest euclid distance between some pair of points. After each step Petya gains the score which is equal to the product of these values. Find out which is the maximal score Petya can gain after the whole game.
    Input

    Input contains single integer number N (0 ≤ N ≤ 1000).

    Output

    Output the maximal score that Petya can gain. Your answer must be accurate up to 10-3.

    Example(s)
    sample input
    sample output
    2
    
    5.000
    
    sample input
    sample output
    4
    
    20.000
     #include<iostream>
    #include<string.h>
    #include<stdio.h>
    #include<ctype.h>
    #include<algorithm>
    #include<stack>
    #include<queue>
    #include<set>
    #include<math.h>
    #include<vector>
    #include<map>
    #include<deque>
    #include<list>
    using namespace std;
    int a[];
    int b[]; int main()
    {
    //freopen("in.txt", "r", stdin);
    int n;
    scanf("%d", &n);
    a[] = ;
    b[] = ; if (n == ) printf("0.000\n");
    else if (n == )printf("1.000\n");
    else if (n == )printf("5.000\n");
    else
    {
    double ans = ;
    int m = , d = ;
    for (int i = ; i <n; i++)
    {
    if ((m + )*d >= m*(d + ))
    m++;
    else
    d++;
    ans += m*d;
    }
    printf("%.3lf\n", ans);
    } return ;
    }

SGU 403 Game with points的更多相关文章

  1. SGU 403 Scientific Problem

    403. Scientific Problem Time limit per test: 0.25 second(s)Memory limit: 65536 kilobytes input: stan ...

  2. SGU - 403 - Scientific Problem (水)

    403. Scientific Problem Time limit per test: 0.25 second(s) Memory limit: 65536 kilobytes input: sta ...

  3. 今日SGU 5.13

    SGU 146 题意:就是给你一个长度为l的圈,然后你跑步,每一段给你时间t和速度v,问你最后离起点多远 收获:就是把浮点数转为整数,然后但是会出现精度误差,比如l最多四位小数,那你就加0.00001 ...

  4. SGU 532. Building Foundation 暴力

    532. Building Foundation 题目连接: http://acm.sgu.ru/problem.php?contest=0&problem=532 Description A ...

  5. apache httpd服务器403 forbidden的问题

    一.问题描述 在apache2的httpd配置中,很多情况都会出现403. 刚安装好httpd服务,当然是不会有403的问题了.主要是修改了一些配置后出现,问题描述如下: 修改了DocumentRoo ...

  6. 有理数的稠密性(The rational points are dense on the number axis.)

    每一个实数都能用有理数去逼近到任意精确的程度,这就是有理数的稠密性.The rational points are dense on the number axis.

  7. [LeetCode] Max Points on a Line 共线点个数

    Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...

  8. 遇到 HTTP 错误 403.14 - Forbidden?

    打开 http://localhost:1609 报错: HTTP 错误 403.14 - Forbidden Web 服务器被配置为不列出此目录的内容 解决方案一:设置默认首页 在 Web.conf ...

  9. nginx 访问目录403

    centos7.2默认安装好nginx后,会在/usr/share/nginx/html下作为主目录 但是如果想访问下面的目录会发现没有权限,返回403错误 这时候要注意在/etc/nginx/ngi ...

随机推荐

  1. skb_pull skb_push skb_put

    unsigned char *skb_pull(struct sk_buff *skb, int len)该函数将 data 指针向数据区的末尾移动,减少了len 字段的长度.该函数可用于从接收到的数 ...

  2. C# 日文网址转punnycode

    Uri uri = new Uri(url); IdnMapping idn = new IdnMapping();url= url.Replace(uri.Host, idn.GetAscii(ur ...

  3. MySQL -- JDBC

    一 . JDBC的开发步骤 1.准备四大参数 2.注册驱动 3.获得连接 4.获得语句执行者 5.执行sql语句 6.处理结果 7.释放资源 1.准备四大参数 /* * jdbc四大配置参数 * &g ...

  4. scrapy shell命令的【选项】简介

    在使用scrapy shell测试某网站时,其返回400 Bad Request,那么,更改User-Agent请求头信息再试. DEBUG: Crawled () <GET https://w ...

  5. Ibatis.Net 各种配置说明学习(二)

    1.各个配置文件的配置说明 providers.config:指定数据库提供者,.Net版本等信息. xxxxx.xml:映射规则. SqlMap.config:大部分配置一般都在这里,如数据库连接等 ...

  6. jmert jdbc request支持执行多条sql语句并设置jdbc字符集

    1.jdbc request支持执行多条sql语句 在JDBC Connection Configuration中的sql连接字串中添加如下内容 allowMultiQueries=true 如下图: ...

  7. MySQL学习笔记:definer与sql security

    在以下例子中,出现definer于sql security invoker,导致不解,遂学习一翻. # 创建存储过程 DELIMITER $$ CREATE DEFINER = Hider@local ...

  8. Atom编辑器试用(Win7)

     看到Atom的官网(https://atom.io/)上说,Atom是A hackable text editor for the 21st Century,是一个基于V8引擎的editor,于是决 ...

  9. day6作业--游戏人生

    本节作业: 熟练使用类和模块,写一个交互性强.有冲突的程序. 思路: 1.各个模块之间的调用关系,如何使用类,各种方法的使用上面: 2.学了类,以为能用来解决所有问题,东西都要写在类里面: 3.下面自 ...

  10. 自动化CI构建工具

    hudson/maven jenkins,bamboo, hudson