找规律
来源:互联网 发布:网店进销存软件免费版 编辑:程序博客网 时间:2024/04/20 08:51
D - The Monster and the Squirrel
Ari the monster always wakes up very early with the first ray of the sun and the first thing she does is feeding her squirrel.
Ari draws a regular convex polygon on the floor and numbers it's vertices 1, 2, ..., n in clockwise order. Then starting from the vertex 1 she draws a ray in the direction of each other vertex. The ray stops when it reaches a vertex or intersects with another ray drawn before. Ari repeats this process for vertex 2, 3, ..., n (in this particular order). And then she puts a walnut in each region inside the polygon.
Ada the squirrel wants to collect all the walnuts, but she is not allowed to step on the lines drawn by Ari. That means Ada have to perform a small jump if she wants to go from one region to another. Ada can jump from one region P to another region Q if and only if P and Q share a side or a corner.
Assuming that Ada starts from outside of the picture, what is the minimum number of jumps she has to perform in order to collect all the walnuts?
Input
The first and only line of the input contains a single integer n (3 ≤ n ≤ 54321) - the number of vertices of the regular polygon drawn by Ari.
Output
Print the minimum number of jumps Ada should make to collect all the walnuts. Note, that she doesn't need to leave the polygon after.
Example
Input
5
Output
9
Input
3
Output
1
Note
One of the possible solutions for the first sample is shown on the picture above.
#include<stdio.h>
#include<math.h>
int main()
{
int n;
double sum;
scanf("%d",&n);
n=n-2;
sum=pow(n,2);
printf("%.0lf",sum);
return 0;
}
求平方。
- 找规律
- 找规律!
- 找规律
- 找规律,
- 找规律
- 找规律
- 找规律
- 找规律
- 找规律
- 找规律
- 找规律
- 找规律
- 找规律
- 递归(找规律、找出口)
- 数字找规律
- POJ1450 Gridland [找规律]
- 1694. Spiral (找规律)
- 【找规律】【ZJOI2009】函数
- 湾区码农赚的几万 referral bonus,大家都能拿到了...
- 实现基于mysql验证的vsftpd虚拟用户
- 为什么覆盖equals方法一定要覆盖hashCode方法
- Python从零开始系列连载(4)——Python的基本数据类型(下)
- String类的比较问题
- 找规律
- css美化页面,css入门案例,css的代码规范,放置规范,格式规范,代码规范
- mysql按日期分组(group by)查询统计的时候,没有数据补0的解决办法。
- CodeWarrior for S12(X) 在全芯片仿真下使用调试器与模拟芯片通讯
- IDEA+Maven+SpringBoot+springloaded热加载配置笔记
- 三家人
- JQuery实例 -- 全选
- 【HTML】table应用
- 可靠数据传输原理