A Very Easy Triangle Counting Game
题意:在圆上取n个点,相邻两个点之间连线,(注意,n和1相邻),然后所有点对(i ,i+2)相连,问能形成的不同的三角形有多少个?
思路:找规律
n=3,cnt=1;
n=4,cnt=8;
n=5 cnt=35 (5*2+5*2+ 5+5+5);
n=6 cnt= 32 (6*2+6*2+ 6+2);
n=7,cnt=35 (7*2+7*2+7);
n=8, cnt=40 (8*2+8*2+8)
n>6;cnt=5*n;
AC代码:
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
#define m 20121111
int main()
{
int t,n;
scanf("%d",&t);
int cas=;
while(t--)
{
int ans;
scanf("%d",&n);
if(n<)
ans = ;
else if(n == )
ans = ;
else if(n == )
ans = ;
else if(n == )
ans = ;
else if(n == )
ans = ;
else
ans = *n;
printf("Case #%d: %d\n",cas++,ans%m);
}
return ;
}
A Very Easy Triangle Counting Game的更多相关文章
- acdream.A Very Easy Triangle Counting Game(数学推导)
A - A Very Easy Triangle Counting Game Time Limit:1000MS Memory Limit:64000KB 64bit IO Forma ...
- uva 11401 Triangle Counting
// uva 11401 Triangle Counting // // 题目大意: // // 求n范围内,任意选三个不同的数,能组成三角形的个数 // // 解题方法: // // 我们设三角巷的 ...
- [Usaco2010 OPen]Triangle Counting 数三角形
[Usaco2010 OPen]Triangle Counting 数三角形 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 394 Solved: 1 ...
- bzoj 1914: [Usaco2010 OPen]Triangle Counting 数三角形 容斥
1914: [Usaco2010 OPen]Triangle Counting 数三角形 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 272 Sol ...
- bzoj1914 [Usaco2010 OPen]Triangle Counting 数三角形 计算机和
[Usaco2010 OPen]Triangle Counting 数三角形 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 526 Solved: 2 ...
- uva11401:Triangle Counting 递推 数学
uva11401:Triangle Counting 题目读不清楚的下场就是多做两个小时...从1-n中任选3个不重复数字(不重复啊!!坑爹啊!)问能组成三角形的有多少个, 显然1~n能组成的三角形集 ...
- 【UVA 11401】Triangle Counting
题 题意 求1到n长度的n根棍子(3≤n≤1000000)能组成多少不同三角形. 分析 我看大家的递推公式都是 a[i]=a[i-1]+ ((i-1)*(i-2)/2-(i-1)/2)/2; 以i 为 ...
- [bzoj1914] [Usaco2010 OPen]Triangle Counting 数三角形
跑去看了黄学长的题解.. 第一次听说级角排序= =因为一直见计算几何就跑= = 级角排序就是按 原点和点连起来的边 与x轴正半轴构成的角的角度 排序...排序完效果就是逆时针旋转地枚举每个点. 要求的 ...
- Triangle Counting UVA - 11401(递推)
大白书讲的很好.. #include <iostream> #include <cstring> using namespace std; typedef long long ...
随机推荐
- quartz群调查调度机制和源代码分析
pageId=85056282#quartz集群调度机制调研及源代码分析-quartz2.2.1集群调度机制调研及源代码分析" style="color:rgb(59,115,17 ...
- Http的操作(不传递参数)
ttpResponse httpResponse = null; HttpEntity httpEntity = null; HttpGet httpGet = new HttpGet ...
- linux路由表配置
一.原理说明 1.路由表(table)从0到255进行编号,每个编号可以对应一个别名,编号和别名的对应关系在linux下放在/etc/iproute2/rt_tables这个文件里,一般0编号的tab ...
- 更换Winform 皮肤(下)----完全GDI+绘制
skin皮肤和DLL程序及文件:下载 链接:http://www.cnblogs.com/DebugLZQ/archive/2013/04/15/3021659.html
- 基于visual Studio2013解决算法导论之002归并排序
题目 归并排序 解决代码及点评 #include <stdio.h> #include <stdlib.h> #include <malloc.h> #in ...
- shapefile 编码错误问题解决 Wrong codepage of shapefile Warning 1: One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1.
linux下运行,因为大部分shapefile 文件,在使用时都没有指定字符集,所以qgis只能从环境变量中获取设置环境变量中获取SHAPE_ENCODING. 目前唯一的解决办法就是设置环境变量 $ ...
- 谁知道哪有比较好的Beijing Milonga?想去参加这样的阿根廷探戈舞会~
谁知道哪有比较好的Beijing Milonga?想去参加这样的阿根廷探戈舞会~_百度知道 谁知道哪有比较好的Beijing Milonga?想去参加这样的阿根廷探戈舞会~ 2009-1 ...
- [Codecademy] HTML&CSS第八课:Design a Button for Your Webwite
本文出自 http://blog.csdn.net/shuangde800 [Codecademy] HTML && CSS课程学习目录 --------------------- ...
- Study notes for Latent Dirichlet Allocation
1. Topic Models Topic models are based upon the idea that documents are mixtures of topics, where a ...
- Juuluu 旗下企业站点管理系统3.0.1公布!
KgE金刚企业站点管理系统是广州聚龙软件为国内中小企业开发的一款企业站点管理系统,KgE採用可视化的标签模型,可在Dreamvear等网页编辑下可视化编辑,KgE使用javaeemsyqlyuijqu ...