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.

InputThe 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 ≤ 1000OutputFor 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

题意:给定3^0,3^1...3^N;问子集的和有多少种,因为前缀和小于当前数,所以每次加入都有2种方案(选或不选,其结果不同),所以答案是pow(2,N)。

思路:可以用高精度,也可以直接用pow。

#include<bits/stdc++.h>
using namespace std;
int main()
{
int T,N;
scanf("%d",&T);
while(T--){
cin>>N;
cout<<fixed<<setprecision()<<pow(,N)<<endl;
}
return ;
}

HDU - 6433: H. Pow (简答题,输出大数)的更多相关文章

  1. 《web前端设计基础——HTML5、CSS3、JavaScript》 张树明版 简答题简单整理

    web前端设计基础——HTML5.CSS3.JavaScript 简答题整理 第一章 (1)解释一下名词的含义:IP地址.URL.域名   iP定义了如何连入因特网,以及数据如何在主机间传输的标准. ...

  2. 他答对一半(打一字)asp.net开源简答题项目

    先出个字谜: 他答对一半(打一字) 你猜出来了没? 可以到这个网址答题:http://m.hovertree.com/miyu/bjae/4fpmm2td.htm 看你的答案是否正确. 这是ASP.N ...

  3. hdu 4099 Revenge of Fibonacci 字典树+大数

    将斐波那契的前100000个,每个的前40位都插入到字典树里(其他位数删掉),然后直接查询字典树就行. 此题坑点在于 1.字典树的深度不能太大,事实上,超过40在hdu就会MLE…… 2.若大数加法时 ...

  4. 『Python题库 - 简答题』 Python中的基本概念 (121道)

    ## 『Python题库 - 简答题』 Python中的基本概念 1. Python和Java.PHP.C.C#.C++等其他语言的对比? 2. 简述解释型和编译型编程语言? 3. 代码中要修改不可变 ...

  5. HDU 1002 A + B Problem II (大数加法)

    题目链接 Problem Description I have a very simple problem for you. Given two integers A and B, your job ...

  6. hdu Minimum Transport Cost(按字典序输出路径)

    http://acm.hdu.edu.cn/showproblem.php? pid=1385 求最短路.要求输出字典序最小的路径. spfa:拿一个pre[]记录前驱,不同的是在松弛的时候.要考虑和 ...

  7. HDU 2100 Lovekey (26进制大数、字符串)

    Lovekey Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Sub ...

  8. HDU 5351 MZL's Border (规律,大数)

    [HDU 5351 MZL's Border]题意 定义字符串$f_1=b,f_2=a,f_i=f_{i-1}f_{i-2}$. 对$f_n$的长度为$m$的前缀$s$, 求最大的$k$满足$s[1] ...

  9. hdu 5429 Geometric Progression(存个大数模板)

    Problem Description Determine whether a sequence is a Geometric progression or not. In mathematics, ...

随机推荐

  1. 系统OOM复位定位

    定位OOM的工具: 1.多次收集Thread Dump信息kill -3  PID通过对比分析heap 对象信息和Thread信息来定位 2.通过 -Xloggc:D:/gc.log  -XX:+He ...

  2. 【Java Web】把逻辑名映射到servlet文件

    Ⅰ.请求URL Ⅱ.容器搜索DD,查找servlet-mapping <?xml version="1.0" encoding="ISO-8859-1" ...

  3. invalid derived query的解决办法

    标签: eclipse / invalid / derived / 解决办法 / 校验功能 479 在Eclipse的运行过程中,突然有一个接口跳出如下错误: invalid derived quer ...

  4. dotnet new vue [C# 使用 vuejs]

    1. 安装 dotnet sdk 2.0 2. 安装 nodejs , npm 3. 安装淘宝镜像 4. 更新npm :   npm update -g 5. dotnet new -i vue 6. ...

  5. nagios报错Error: No such CGI app - /usr/local/nagios/sbin/nagios/cgi-bin/status.cgi may not exist or is not executable by this process.

    加上rewrite rewrite ^/nagios/cgi-bin/(.*)\.cgi /$.cgi break;  

  6. thinkPHP中怎么使用阿里云的sdk

    使用阿里云官方给的方法总会报错 Class 'Home\Controller\DefaultProfile' not found 这样是因为namespace的原因,将aliyun sdk 放在con ...

  7. 一些C语言里面的编程

    C语言的知识还是不要忘的好: 1.求最大公约数的函数: #include <stdio.h> #define min(a,b) (a)>(b)?(b):(a) int gcd(int ...

  8. 判断浏览器是否支持某一个CSS3属性

    判断浏览器是否支持某一个CSS3属性 function supportCss3(style) { var prefix = ['webkit', 'Moz', 'ms', 'o'], i, humpS ...

  9. 报错HTTP Status 500 - Unable to instantiate Action

    报错如下: HTTP Status 500 - Unable to instantiate Action, visitAction, defined for 'visit_toAddPage' in ...

  10. 在线演示demo

    *{display:none} 仿微博添加和删除动画 body{} input,button,select,textarea{outline:none;} .sdiv{width:400px;} .b ...