F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Sawtooth

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 3292    Accepted Submission(s): 1217


Problem Description
Think about a plane:

¡ñ One straight line can divide a plane into two regions.
¡ñ Two lines can divide a plane into at most four regions.
¡ñ Three lines can divide a plane into at most seven regions.
¡ñ And so on...

Now we have some figure constructed with two parallel rays in the same direction, joined by two straight segments. It looks like a character ¡°M¡±. You are given N such ¡°M¡±s. What is the maximum number of regions that these ¡°M¡±s can divide a plane ?

 

Input
The first line of the input is T (1 ¡Ü T ¡Ü 100000), which stands for the number of test cases you need to solve.

Each case contains one single non-negative integer, indicating number of ¡°M¡±s. (0 ¡Ü N ¡Ü 1012)
 

Output
For each test case, print a line ¡°Case #t: ¡±(without quotes, t means the index of the test case) at the beginning. Then an integer that is the maximum number of regions N the ¡°M¡± figures can divide.
 

Sample Input
2 1 2
 

Sample Output
Case #1: 2 Case #2: 19
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-25 09:17:50, Gzip enabled