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. linux音频alsa-uda134x驱动文档阅读之一转自http://blog.csdn.net/wantianpei/article/details/7817293

    前言 目前,linux系统常用的音频驱动有两种形式:alsa oss alsa:现在是linux下音频驱动的主要形式,与简单的oss兼容.oss:过去的形式而我们板子上的uda1341用的就是alsa ...

  2. Linux修改主机名【转】

    一.永久修改修改/etc/sysconfig/network,在里面指定主机名称HOSTNAME=然后执行命令hostname 主机名这个时候可以注销一下系统,再重登录之后就行了. 或者修改/etc/ ...

  3. SpringCloud常用注解

    一 @EnableDiscoveryClient,@EnableEurekaClient的区别 SpringCLoud中的“Discovery Service”有多种实现,比如:eureka, con ...

  4. python基础-类的起源

    Python中一切事物都是对象. class Foo(object): def __init__(self,name): self.name = name f = Foo("alex&quo ...

  5. XP远程连接Win10,提示【远程计算机需要网络级别身份验证,而您的计算机不支持该验证】

    最近电脑安装了Win10系统,在办公室可以通过其他电脑远程,但是回去后使用自己的电脑(XP系统)进行远程提示失败, 提示[远程计算机需要网络级别身份验证,而您的计算机不支持该验证],然后上网查找资料, ...

  6. windows下redis服务操作

    安装redis服务redis-server --service-install redis.windows.conf --service-name Redis26380 --loglevel verb ...

  7. INSTEAD OF与AFTER触发器

    INSTEAD OF 触发器 AFTER 触发器(也叫“FOR”触发器)会在触发 insert.update 或是delect 动作之后执行.例如,一个 Employees 表上的 AFTER 触发器 ...

  8. 微信接口问题(The underlying connection was closed: An unexpected error occurred on a send)

    突然在调用微信接口是报:The underlying connection was closed: An unexpected error occurred on a send错误,跟踪了半天,是因为 ...

  9. Java 中byte 与 char 的相互转换 Java基础 但是很重要

    char转化为byte: public static byte[] charToByte(char c) {        byte[] b = new byte[2];        b[0] = ...

  10. bzoj 1879 容斥

    暴力求容斥系数或者直接组合数求容斥系数都可以. #include<bits/stdc++.h> #define LL long long #define fi first #define ...