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. 20145208 《Java程序设计》第4周学习总结

    20145208 <Java程序设计>第4周学习总结 教材学习内容总结 继承 在学习指导中我了解到继承是符合DRY原则的,DRY(Don't repeat yourself),字面意思来看 ...

  2. FileItem类 用法详解

    FileItem类的常用方法 1.boolean  isFormField().isFormField方法用来判断FileItem对象里面封装的数据是一个普通文本表单字段,还是一个文件表单字段.如果是 ...

  3. java内存优化牛刀小试

    小猿做了两年的c++,上个月竟然被调到java项目,于是第一篇随笔就想八一八java的内存优化. 首先优化这种事,肯定是应该放到最后去做的,不过在写代码的过程中养成良好的习惯也是很重要的.在这里先推荐 ...

  4. sql server 2008 基础知识

    一.配置管理器   1.管理服务 使用配置管理器可以启动.停止.重新启动.继续或暂停服务. 服务器和客户端网络协议 2.SQLSMS 简介:SQLSMS是一个集成环境,用于访问.配置.管理和开发SQL ...

  5. Linq之隐式类型、自动属性、初始化器、匿名类

    目录 写在前面 系列文章 隐式类型 自动属性 初始化器 匿名类 总结 写在前面 上篇文章是本系列的小插曲,也是在项目中遇到,觉得有必要总结一下,就顺手写在了博客中,也希望能帮到一些朋友.本文将继续介绍 ...

  6. 年前辞职-WCF入门(6)

    前言 昨天早上去医院做入职体检,被告知要预约,本以为是要排队,我连视频都准备好了...结果就回来了.下午去了新公司那边找房子,2了,因为公司提供了班车列表,我既然就只在班车所经过的几个地方找,却遗漏了 ...

  7. 每天一个linux命令(51):rcp命令

    rcp代表“remote file copy”(远程文件拷贝).该命令用于在计算机之间拷贝文件.rcp命令有两种格式.第一种格式用于文件到文件的拷贝:第二种格式用于把文件或目录拷贝到另一个目录中. 1 ...

  8. 2015级C程序设计课程开始了

    今年重新接手软件工程文科班的教学,应更从的结合文科班学习基础与 学习方式对授课方式进行调整,以便能取得好的教学效果.

  9. nav ccsss

    /*header: Navigation public style*/header:before, header:after ,.navigation:before, .navigation:afte ...

  10. golang thrift 源码分析,服务器和客户端究竟是如何工作的

    首先编写thrift文件(rpcserver.thrift),运行thrift --gen go rpcserver.thrift,生成代码 namespace go rpc service RpcS ...