cf#328-B. The Monster and the Squirrel-水题+数学规律
来源:互联网 发布:农村淘宝有什么优势 编辑:程序博客网 时间:2024/05/09 02:14
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; }
0 0
- cf#328-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 round The Monster and the Squirrel 529B (数学规律)
- Codeforces 592B The Monster and the Squirrel 【规律题】
- Codeforces Round #328 (Div. 2) B. The Monster and the Squirrel (规律)
- codeforces B. The Monster and the Squirrel
- B. The Monster and the Squirrel
- 【Codeforces Round 328 (Div 2)B】【找规律】The Monster and the Squirrel 正多边形连边分割块数
- The Monster and the Squirrel(规律题)
- CodeForces 592B 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) 592 B. The Monster and the Squirrel
- Code Forces 592 B. The Monster and the Squirrel(水~)
- web开发 http生产者、消费者请求限定(跟着开涛学SpringMVC)
- 浪潮集团云计算参观之旅
- cf#328-A. PawnChess-水题
- ios图片拉伸技巧
- 另一种导致的原因:java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/
- cf#328-B. The Monster and the Squirrel-水题+数学规律
- 数字图像处理2--数学基础(傅立叶,拉普拉斯,卷积,差分计算)
- 笛卡尔 变数
- 同步与异步的区别
- LightOJ - 1407 Explosion(2-SAT)
- No.1 Nim Game 取物游戏
- Intel- 64 与 IA-32架构软件开发人员手册 中文版
- 【学习笔记0001】Go初学者需要关注的50个注意事项
- hdu5525 Product 费马小定理