http://codeforces.com/contest/592/problem/B
给你一个正n边型
让你在每个顶点画n-3条线 与别的顶点连起来
(如果从某个顶点发出线段的过程遇到连过的线。则发出的线就被截断,)
(如果a-b已经有线了,轮到b时,就不用对a射出一条线)
求出最后把整个正n边形分成几块
画了个6边形,
发现 第一个顶点可以分成n-2块,第二个顶点可以分多 n-3块
然后剩下的 除了最后一个顶点 都是分成n-4块
最后一个顶点是 n-3块。。
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <vector>
using namespace std;
__int64 min(__int64 a,__int64 b)
{
return a<b?a:b;
}
int main()
{
__int64 n;
scanf("%I64d",&n);
__int64 i;
__int64 tt=n-2;
__int64 ans=n-2+n-3;
for (i=3;i<n;i++)
{
ans+=n-4;
}
if (n>=4)
ans+=n-3;
printf("%I64d\n",ans);
return 0;
}