HDU 2013 蟠桃记

来源:互联网 发布:上海ug编程培训班 编辑:程序博客网 时间:2024/05/16 09:08

题目地址:点击打开链接

思路:水题

AC代码:

#include <iostream>using namespace std;int f(int x){    if(x == 1)        return 1;    return (f(x-1)+1)*2;}int main(){    int n;    while(cin>>n)    {        cout<<f(n)<<endl;    }    return 0;}


0 0
原创粉丝点击