B. The Monster and the Squirrel
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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.

Examples
input
5
output
9
input
3
output
1
Note

One of the possible solutions for the first sample is shown on the picture above.

题意: 读懂题意划线  从一个点 向其他n-1个点划线 不能与已经划的线相交  问分成了多少 部分

题解:找规律

n       3   4    5    6   ....

ans     1   4    9   16....

3    5     7 插值 为2的等差

#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<stack>
#include<map>
#define ll __int64
#define pi acos(-1.0)
using namespace std;
ll n;
ll ans;
ll exm;
int main()
{ ans=;
exm=;
scanf("%I64d",&n);
for(ll i=;i<=n;i++)
{
ans+=exm;
exm+=;
}
cout<<ans<<endl;
return ;
}

最新文章

  1. .net 4.0 ValidateRequest=&quot;false&quot; 无效
  2. 【知识积累】使用Httpclient实现网页的爬取并保存至本地
  3. iOS 图形图像动画 Core Animation
  4. cell长按出错
  5. WP8:在Cocos2d-x中使用OpenXLive
  6. 重拾ZOJ 一周解题
  7. javascript设计模式学习之十四——中介者模式
  8. 128. Longest Consecutive Sequence
  9. js基础知识总结(全)
  10. REST、SOA、SOAP、RPC、ICE、ESB、BPM知识汇总及理解
  11. GitBook整理
  12. 用js实现插入排序
  13. 数据挖掘学习笔记--AdaBoost算法(一)
  14. ch340是什么芯片
  15. UESTC1599-wtmsb-优先队列
  16. Layx——网页弹窗最佳选择.
  17. 依赖注入[7]: .NET Core DI框架[服务注册]
  18. 微信小程序上传文件遇到的坑
  19. Galaxian 小蜜蜂
  20. ios 逆向编程(环境搭建)

热门文章

  1. 【Codebase】JQuery获取表单部分数据提交方法
  2. 关于 PHP 程序员技术职业生涯规划
  3. 牛客网暑期ACM多校训练营(第四场) F Beautiful Garden
  4. C++ 二叉搜索树
  5. [学习笔记]CSS选择器
  6. 理解Queue队列中join()与task_done()的关系
  7. 在ddms 里面查看data/data里面的东西 不显示data/data
  8. 如何在react里嵌入iframe?
  9. USACO Section2.1 Sorting a Three-Valued Sequence 解题报告
  10. 手动实现一个lazyMan