首页 技术 正文
技术 2022年11月13日
0 收藏 500 点赞 4,067 浏览 1472 个字

A – A Very Easy Triangle Counting Game

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

Submit Status Practice ACdream 1008

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.

acdream.A Very Easy Triangle Counting Game(数学推导)

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.

acdream.A Very Easy Triangle Counting Game(数学推导)

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

acdream.A Very Easy Triangle Counting Game(数学推导)

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 ;
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,987
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,503
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,347
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,130
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,765
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,842