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. springboot与redis的无缝整合(分布式)

    参考博客 : https://blog.csdn.net/csao204282/article/details/54092997 1 首先得引入依赖 <dependency> <gr ...

  2. Nginx 启动脚本

    Nginx 启动脚本 1.vim /etc/init.d/nginx #!/bin/bash # chkconfig: - 30 21 # description: http service. # S ...

  3. Java中Collections.sort()排序详解

      public static void main(String[] args) { List<String> list = new ArrayList<String>(); ...

  4. gitlab 卸载

    gitlab 卸载 清理命令 sudo gitlab-ctl uninstall sudo gitlab-ctl cleanse sudo gitlab-ctl remove-accounts 停止g ...

  5. ES使用中遇到的多种坑,以及解决方案

    1.查询不到导致404报错 在使用get或者search进行查询获取文档的时候,如果没有结果会抛出404的异常. 我们当然不希望抛出异常,这时候就要使用ignore这个参数来忽略报错,ignore可以 ...

  6. html笔记(1)

    hgroup 代替div figure figcaption 独立流内容 替代 dl mark 替代 span

  7. Dib to Bitmap doesn't work in WPF

    一.Dib to Bitmap doesn't work in WPF 代码如下: protected byte[] BitmapFromDIB(IntPtr pDIB, IntPtr pPix) { ...

  8. mysql数据库(三):查询的其他用法

    一. 查询—IN的用法 语法:select ... from 表名 where 字段 a in (值b, 值c, 值d...) 等价于 select ... from 表名 where 字段a=值b ...

  9. 《Advanced Bash-scripting Guide》学习(一):对一个增强和广义的删除logfile的脚本的理解

    本文所选的例子来自于<Advanced Bash-scripting Gudie>一书,译者 杨春敏 黄毅 cleanup:一个增强和广义的删除logfile的脚本 #!/bin/bash ...

  10. IOS-RunTime应用

    什么是Runtime 总结起来,iOS中的RunTime的作用有以下几点: 1.发送消息(obj_msgSend) 2.方法交换(method_exchangeImplementations) 3.消 ...