Run

Run

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1047    Accepted Submission(s): 459

Problem Description

AFA is a girl who like runing.Today,he download an app about runing .The app can record the trace of her runing.AFA will start runing in the park.There are many chairs in the park,and AFA will start his runing in a chair and end in this chair.Between two chairs,she running in a line.she want the the trace can be a regular triangle or a square or a regular pentagon or a regular hexagon.
Please tell her how many ways can her find.
Two ways are same if the set of chair that they contains are same.

Input

There are multiply case.
In each case,there is a integer n(1 < = n < = 20)in a line.
In next n lines,there are two integers xi,yi(0 < = xi,yi < 9) in each line.

Output

Output the number of ways.

Sample Input

4

0 0

0 1

1 0

1 1

Sample Output

1

Source

BestCoder Round #50 (div.2)

题意:给你n个整数点,判断从中任取某些点能否组成正多边形,有几种可能情况(整数点可能情况只能是正方形,

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>

using namespace std;

#define N 25

int n;

struct node
{
    int x, y;
}P[N];

int slove(int i, int j, int k, int q)
{
    if(i == j || i == k)
        return false;
    if(i == q || j == k)
        return false;
    if(j == q || k == q)
        return false;

    int w = 0, num[8];
    memset(num, 0, sizeof(num));

    num[w++] = (P[i].x-P[j].x)*(P[i].x-P[j].x)+(P[i].y-P[j].y)*(P[i].y-P[j].y);
    num[w++] = (P[i].x-P[k].x)*(P[i].x-P[k].x)+(P[i].y-P[k].y)*(P[i].y-P[k].y);
    num[w++] = (P[i].x-P[q].x)*(P[i].x-P[q].x)+(P[i].y-P[q].y)*(P[i].y-P[q].y);
    num[w++] = (P[j].x-P[k].x)*(P[j].x-P[k].x)+(P[j].y-P[k].y)*(P[j].y-P[k].y);
    num[w++] = (P[j].x-P[q].x)*(P[j].x-P[q].x)+(P[j].y-P[q].y)*(P[j].y-P[q].y);
    num[w++] = (P[q].x-P[k].x)*(P[q].x-P[k].x)+(P[q].y-P[k].y)*(P[q].y-P[k].y);

    sort(num, num+w);

    w = unique(num, num+w) - num;

    if(w != 2)
        return false;
    return true;
}

int main()
{
    while(scanf("%d", &n) != EOF)
    {
        int ans = 0;

        for(int i = 1; i <= n; i++)
            scanf("%d%d", &P[i].x, &P[i].y);

        for(int i = 1; i <= n; i++)
            for(int j = i+1; j <= n; j++)
                for(int k = j+1; k <= n; k++)
                    for(int q = k+1; q <= n; q++)
                        if(slove(i, j, k, q))
                            ans++;

        printf("%d\n", ans);
    }
    return 0;
}

  

时间: 2024-08-11 23:30:30

Run的相关文章

docker run常用命令及 解决 ubuntu镜像无法识别 ifconfig ping 命令

docker run -it     docker 前端启动 container容器           -d             后端启动 container容器           -p             固定端口映射            -P             不固定端口映射           --name         给生成的容器起名字docker ps:默认显示正在运行的container       ps -a 显示所有的container容器docker r

Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

1.事件描述:CentOS7下使用tree命令,发现该命令没有被安装,在安装的过程中发现yum报错 [[email protected] ~]# tree -d bash: tree: 未找到命令... [[email protected] ~]# yum -y install tree 已加载插件:fastestmirror, langpacks Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast

Linux联接vsftpd:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()错误

当我们限定了用户不能跳出其主目录之后,使用该用户登录FTP时往往会遇到这个错误: [html] view plaincopy 500 OOPS: vsftpd: refusing to run with writable root inside chroot () 这个问题发生在最新的这是由于下面的更新造成的: [html] view plaincopy - Add stronger checks for the configuration error of running with a wri

duplicate from active dg 的 run 脚本 sfile 为完整配置可能导致的一些错误

oracle 11g RMAN:Active Database Duplication for standby database 创建dg 命令解读 继上篇如果没有正确配置,理解duplicate from active  dg 的 run 脚本,就会出现以下错误: 1:路径不存在: Oracle instance shut down connected to auxiliary database (not started) RMAN-00571: =======================

Docker run 参考指南

Docker run参考指南 docker运行在一个独立的隔离的进程中. 当用户执行dockerrun,它将启动一个有着独立的文件系统,独立的网络和独立的进程树的进程. 基本的docker run命令的格式: docker run  [OPTIONS] IMAGE[:TAG] [COMMAND] [ARG...] [OPTIONS]分为两种: 1.对于用户独占性的设置: 前台.后台运行 容器定义 网络设定 容器在CPU和内存中的运行时间 运行权限和LXC配置 2.在操作者和开发者之间的共享设定,

linux下.run文件的安装与卸载

.run文件的安装很简单,只需要为该文件增加可执行属性,即可执行安装 以 virtualbox 的安装文件 virtualbox-3.1.6-59338-Linux_x86.run为例,只需要输入命令: chmod +x  virtualBox-3.1.6-59338-Linux_x86.run ./virtualbox-3.1.6-59338-Linux_x86.run 即可安装. www.2cto.com 卸载的方法网上说法大至分两种: 一种是说用 sh  virtualbox-3.1.6-

Eclipse编译时Cannot run program &quot;make&quot;:?????

在确定环境变量配置正确(命令行运行make成功)的情况下,如果使用Eclipse编译C程序,控制台报告Cannot run program "make":?????"?错误,那么很有可能的错误是org.eclipse.cdt.core.win32_5.2.0.201202111925 (Eclipse的plugin目录下)出现了错误.可以通过替换或者重新安装CDT来解决这个问题. 参考:http://bbs.csdn.net/topics/380228213 Error: C

Coursera compiler Set up environment and Run first program

Environment, Ubuntu 14.04 set up guide Set up cool compiler 1. sudo apt-get install flex bison build-essential csh openjdk-6-jdk libxaw7-dev libc6-i386 2. Make the /usr/class directory sudo mkdir /usr/class 3. Make the directory owned by you sudo cho

npm run dev报错,events.js:160 throw er; // Unhandled &#39;error&#39; event

错误代码如下: [email protected] dev E:MySoftwaretestGitwebpackvue-projectnode build/dev-server.js "8088" events.js:160 throw er; // Unhandled 'error' event ^ Error: listen EACCES 0.0.0.0:8080 at Object.exports._errnoException (util.js:1026:11) at expo

There is insufficient system memory to run this query 错误

服务器环境大致情况如下: 操作系统:   Microsoft Windows Server 2003 R2 Enterprise Edition Service Pack 2 数据库  :   Microsoft SQL Server 2005 - 9.00.5000.00 (Intel X86) . 机器物理内存8G,开启了"使用AWE分配内存选项(U)" 在这台服务器上,创建YourSQLDba后,配置过程中创建函数的时候,报如下错误,重试了几次都是如此,但是其它应用从来没有出过这