蟠桃记——递归
来源:互联网 发布:淘宝叶罗丽娃娃 编辑:程序博客网 时间:2024/05/22 15:12
//Createdby朱正天on2017/8/12.//如何继续处理非2数#include<iostream>#include<cmath>#include<cstdio>#include<sstream>#include<cstring>#include<vector>#include<algorithm>#include<set>#include <windef.h>using namespace std;#define N 10#define ROW 6#define COL 6int a[N]={-1};int c[N]={0};int dp[N][N]={0};//http://acm.hdu.edu.cn/showproblem.php?pid=2013//http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=31180&messageid=1&deep=0//#include<stdio.h>//#include<stdlib.h>////int f(int n, int x)//{// if (n == 1)// {// return x;// }// else// {// return f(n - 1, (x + 1) * 2);// }//}//int main()//{// int num;// while (scanf("%d", &num) != EOF)// {// printf("%d\n", f(num, 1));// }//// return 0;//}int main(){// freopen("F:\\Coding\\c.txt", "r", stdin); //初始化//// int n=0,v=0;// cin>>n>>v;// for (int i = 0; i <n ; ++i) {// cin>>c[i];// } int t=0; cin>>t; int n=0; while(t--){ cin>>n; int sum=1; for (int i = n; i >1 ; --i) { sum=(sum+1)*2; } cout<<sum<<endl; } return 0;}
阅读全文
0 0
- 蟠桃记——递归
- 递归运用--蟠桃记
- 蟠桃记 --简单递归
- hdu2013——蟠桃记
- 2013——蟠桃记
- HDU 2013 蟠桃记【递推】【递归】
- HDU 2013 蟠桃记 (递归+水题)
- 递归递推之蟠桃记
- 递归递推练习 I 蟠桃记
- 递推递归练习I蟠桃记
- 递推递归练习--I(蟠桃记)
- 递推递归--I蟠桃记
- HDU——2013 蟠桃记
- 递归与递推——B-王小二切饼,D-汉诺塔系列1,I-蟠桃记,H-巴蜀之危,G-fighting小银考四级
- 杭电ACM 2013蟠桃记 (递归函数)----20140724
- ACM递推递归练习I 蟠桃记
- 递归递推练习―I―蟠桃记
- HDU——2013——蟠桃记
- 二进制中1的个数、数值的整数次方,数组调整奇数在前偶数在后顺序不变 -- 漫漫算法路 刷题篇
- js实现可刷新的简易计时器
- Android中LocalSocket实战
- 2017.8.26 力 思考记录
- jgGrid 添加时400错误
- 蟠桃记——递归
- 实现Repeater控件的记录单选(二)
- 【背包专题】G
- C/C++volatile关键字详解
- Type 'com.itextpdf.text.List' does not have type parameter
- C#_选择分支语句及循环
- java 加密解密时间戳
- Android6.0平台添加一种新语言与字库
- JS石英钟实现