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

Problem H. Pow

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 2257    Accepted Submission(s): 1144


Problem Description
There are n numbers 3^0, 3^1, . . . , 3^n-1. Each time you can choose a subset of them (may be empty), and then add them up.
Count how many numbers can be represented in this way.
 

Input
The first line of the input contains an integer T , denoting the number of test cases. In each test case, there is a single integers n in one line, as described above.
1 ¡Ü T ¡Ü 20, 0 ¡Ü n ¡Ü 1000
 

Output
For each test case, output one line contains a single integer, denoting the answer.
 

Sample Input
4 9 7 8 233
 

Sample Output
512 128 256 13803492693581127574869511724554050904902217944340773110325048447598592
 

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-04-25 14:27:15, Gzip enabled