Codeforces Round #328 (Div. 2) 592 B. The Monster and the Squirrel
来源:互联网 发布:js获取div下的span 编辑:程序博客网 时间:2024/05/21 15:06
题意:Ari 每天起床的第一件事就是喂松鼠…然后他在他家的地板上画了一个正n边形(真闲….
然后顺时针标号从1~n
然后从1开始向除了1以外的所有顶点连边
然后从2开始向除了2以外的所有顶点连边,但是不能超过之前连过的线
然后从3….n
正五边形大概就是这个样子
Ari在每个区域放了食物
这时候松鼠来了,松鼠只会从一个区域到另外一个区域的时候会跳
然后问松鼠最少跳多少次,能吃完所有食物(这松鼠也是够配合的…
思路:脑补了一下,这道题就等于问有多少个区域…
然后吧… 经过画了一个正方形和六边形发现有个规律就是
例如这个正五边形 我们先不管1 从2开始每次画线都会把一个区域变成三个区域
所以区域数就是 (n-2)*(n-1)个 然后每两个相邻顶点划分出来的n-2个区域会有一个共同的所以就是
(n-2)*(n-1)-(n-2)==(n-2)^2
第一次用的int 顺利WA掉 换成LL就行了
#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#include<math.h>#include<queue>#include<stack>#include<string>#include<vector>#include<map>#include<set>using namespace std;#define rfor(i,a,b) for(i=a;i<=b;++i)#define lfor(i,a,b) for(i=a;i>=b;--i)#define sfor(i,a,h) for(i=h[a];i!=-1;i=e[i].next)#define mem(a,b) memset(a,b,sizeof(a))#define mec(a,b) memcpy(a,b,sizeof(b))#define cheak(i) printf("%d ",i)#define min(a,b) (a>b?b:a)#define max(a,b) (a>b?a:b)#define inf 0x3f3f3f3f#define lowbit(x) (x&(-x))typedef long long LL;#define maxn 100005#define maxm maxn*maxn#define lson(x) (splay[x].son[0])#define rson(x) (splay[x].son[1])int main(){ LL n; scanf("%lld",&n); printf("%lld\n",(n-2)*(n-2)); return 0;}
0 0
- Codeforces Round #328 (Div. 2) 592 B. The Monster and the Squirrel
- Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel(数学规律)
- Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel
- Codeforces Round #328 (Div. 2)B. The Monster and the Squirrel
- Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel (规律)
- Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel
- Codeforces Round #328 (Div. 2)B. The Monster and the Squirrel
- Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel(math)
- 【Codeforces Round 328 (Div 2)B】【找规律】The Monster and the Squirrel 正多边形连边分割块数
- cf 328div 2 B. The Monster and the Squirrel
- Codeforces Round #328 (Div. 2)_B. The Monster and the Squirrel
- codeforces B. The Monster and the Squirrel
- Codeforces 592B The Monster and the Squirrel 【规律题】
- CodeForces 592B The Monster and the Squirrel
- codeforces round The Monster and the Squirrel 529B (数学规律)
- B. The Monster and the Squirrel
- Code Forces 592 B. The Monster and the Squirrel(水~)
- cf#328-B. The Monster and the Squirrel-水题+数学规律
- 一元三次方程求根公式详细逐步推导
- POJ2955:Brackets(区间DP)
- 关于清除浮动
- POJ1651:Multiplication Puzzle(区间DP)
- Codeforces Round #328 (Div. 2) 592A PawnChess
- Codeforces Round #328 (Div. 2) 592 B. The Monster and the Squirrel
- ansible官方文档翻译之变量
- 关于鸣人发招
- Codeforces Round #328 (Div. 2) 592 C. The Big Race
- Codeforces Round #328 (Div. 2) 592 D. Super M 树的直径
- find Minimum and Maximum in Rotated Sorted Arrray
- 二分法 冒泡
- 用Python实现一个类Unix的tail命令
- 对于windows窗口编程的详细注解代码