A - A Very Easy Triangle Counting Game

Time Limit:1000MS     Memory Limit:64000KB     64bit IO Format:%lld & %llu

Description

Speedcell and Shoutmon love triangles very much.One day,they are playing a game named “Triangle Counting”.

In this game,Speedcell draws a round,and draws N points on the circumference of the round evenly,and marks them as 1,2,...,N.

Then Speedcell connects these points using the following rules:

Step 1: Connect the first point with the third point,and connect the third point with the 5th point,...,connect the ith point with the

(i+2)th point(cycling when needed)......It can’t be stopped until we get back to the first point.

Step 2: If there exists some points which don’t be connected still,choose one of them(if marked “i”),and connect it with the

(i+2)th point,then the (i+4)th point as Step1.......If we get back to the ith point,Step 2 will be stopped.

Step 3: Connect all the points as the order 1,2,...,N,1.

Now Speedcell wants to let Shoutmon count the number of triangles on the figure.

Input

The first line of input contains T(T ≤ 1000), indicating the number of cases.

Then T lines follow. Each line an integer N(1 ≤ N ≤ 1000), indicating the number of points.

Output

Each case a line, and output the case number first, then a single integer, indicating the number of triangles.

The answer should be moduloed by 20121111.

Sample Input

3
1
4
6

Sample Output

Case #1: 0
Case #2: 8
Case #3: 32 学了新的数学姿势。
乍一看是找规律,的确,但规律比较特别,在N <= 7 时出现得三角形个数为无规律态。
当大于>7时,规律为 n * 5 ;

acdream.A Very Easy Triangle Counting Game(数学推导)的更多相关文章

  1. A Very Easy Triangle Counting Game

    题意:在圆上取n个点,相邻两个点之间连线,(注意,n和1相邻),然后所有点对(i ,i+2)相连,问能形成的不同的三角形有多少个? 思路:找规律 n=3,cnt=1; n=4,cnt=8; n=5 c ...

  2. 数学 ACdream 1196 KIDx's Triangle

    题目传送门 /* 这道题花了好长时间AC,思路有,但是表达式少写了括号一直乱码,囧! 注意:a==0时要特判:) */ #include <cstdio> #include <alg ...

  3. uva11401:Triangle Counting 递推 数学

    uva11401:Triangle Counting 题目读不清楚的下场就是多做两个小时...从1-n中任选3个不重复数字(不重复啊!!坑爹啊!)问能组成三角形的有多少个, 显然1~n能组成的三角形集 ...

  4. uva 11401 Triangle Counting

    // uva 11401 Triangle Counting // // 题目大意: // // 求n范围内,任意选三个不同的数,能组成三角形的个数 // // 解题方法: // // 我们设三角巷的 ...

  5. [Usaco2010 OPen]Triangle Counting 数三角形

    [Usaco2010 OPen]Triangle Counting 数三角形 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 394  Solved: 1 ...

  6. bzoj 1914: [Usaco2010 OPen]Triangle Counting 数三角形 容斥

    1914: [Usaco2010 OPen]Triangle Counting 数三角形 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 272  Sol ...

  7. bzoj1914 [Usaco2010 OPen]Triangle Counting 数三角形 计算机和

    [Usaco2010 OPen]Triangle Counting 数三角形 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 526  Solved: 2 ...

  8. 借One-Class-SVM回顾SMO在SVM中的数学推导--记录毕业论文5

    上篇记录了一些决策树算法,这篇是借OC-SVM填回SMO在SVM中的数学推导这个坑. 参考文献: http://research.microsoft.com/pubs/69644/tr-98-14.p ...

  9. 关于不同进制数之间转换的数学推导【Written By KillerLegend】

    关于不同进制数之间转换的数学推导 涉及范围:正整数范围内二进制(Binary),八进制(Octonary),十进制(Decimal),十六进制(hexadecimal)之间的转换 数的进制有多种,比如 ...

随机推荐

  1. 学习笔记——Maven实战(三)多模块项目的POM重构

    重复,还是重复 程序员应该有狗一般的嗅觉,要能嗅到重复这一最常见的坏味道,不管重复披着怎样的外衣,一旦发现,都应该毫不留情地彻底地将其干掉.不要因为POM不是产品代码而纵容重复在这里发酵,例如这样一段 ...

  2. 查询一个ID出现2种结果的情况

    项目中书籍分个人和机构,分属不同的表 所以有的时候ID是一样的,那么只根据ID查询书籍就会存在ID=xxx的既有个人又有机构,而通常我们可能只需要一个,多的没做区分就出问题了! 所以数据统一做查询的时 ...

  3. Jmeter使用指南

    序言 由于公司在来年需要进行压力测试,所以也就借节假日的机会来学习一下压力测试的步骤,由于本人的学习时间比较短,希望各位大神朋友们能够多多的谅解并指正在下的错误,在此仅表敬意 适应人群 1.初入门的压 ...

  4. 记<<ssh穿透防火墙连接内网的机器(不用路由端口映射)>>

    场景: 在家连接公司的内网服务器. 需求: 不用设置端口映射在家用putty登录公司内网服务器. 条件: 有一台公网服务器做转发,有开放端口的控制权.(公网服务器可以是阿里云ECS, 腾讯云主机这样的 ...

  5. [USACO2003][poj2187]Beauty Contest(凸包+旋转卡壳)

    http://poj.org/problem?id=2187 题意:老题了,求平面内最远点对(让本渣默默想到了悲剧的AHOI2012……) 分析: nlogn的凸包+旋转卡壳 附:http://www ...

  6. SequoiaDB 系列源码分析调整

    犹豫我经验尚不够丰富,有大牛跟我说,以我这样定下的结构来分析源码,学习效果不太好. 应该先从程序的进程入口函数开始,慢慢的跟流程来分析.先通过系统的启动.退出来分析所用到的技术,像进程模型,线程模型等 ...

  7. 深入理解web项目的配置文件

    1.启动一个WEB项目的时候,WEB容器会去读取它的配置文件web.xml,读取<listener>和<context-param>两个结点. 2.紧急着,容创建一个Servl ...

  8. G-nav-01

    <body><header id="masthead" class="masthead" role="banner"> ...

  9. 【前端】Sublime text3 插件LiveReload 实现实时预览

    1.首先要安装插件LiveReload Sublime text3. 菜单 preferences->packages control,输入install.. 回车,输入LiveReload回车 ...

  10. poj 3070 矩阵快速幂模板

    题意:求fibonacci数列第n项 #include "iostream" #include "vector" #include "cstring& ...