acgo题库
  • 首页
  • 题库
  • 题单
  • 竞赛
  • 讨论
  • 排行
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情题解(0)讨论(0)提交记录(0)
  • 此题答案错误

    此题答案错误,题意应该是n天的石头总和,但测试貌似都是第n天的石头数量。 第n天的数量应该是Σ2^(i-1),i=1…n; 那么n天总和,就是ΣΣ2^(i-1) 如n=2,则总数应该是4,而不是测试中的答案3

    userId_undefined

    Silver

    倔强青铜
    22阅读
    0回复
    1点赞
  • AC

    #include <iostream> using namespace std; int a(int n,int cnt){ if (n==1){ cnt++; } else{ cnt+=a(n-1,cnt)*2+1; } return cnt; } int main(){ int n=0,cnt=0; cin>>n; cnt=a(n,cnt); cout<<cnt; }

    userId_undefined

    徐书睿

    秩序白银
    25阅读
    0回复
    0点赞
  • 100%对

    #include<bits/stdc++.h> using namespace std; void g(int s,int n){ if(n == 0){ cout <<s; return ; } else if(s == 1){ s+=1; } s*=2; s++; g(s,n-1); } int main(){ int s,n; cin >> n; g(s,n); return 0; }

    userId_undefined

    180****9512

    倔强青铜
    16阅读
    0回复
    0点赞
  • 题解

    userId_undefined

    黑客_天之神_ZDZL_zsy

    秩序白银
    12阅读
    0回复
    0点赞
  • AC

    #include<iostream> #include<cmath> using namespace std; int main(){ int n; cin >> n; cout << pow(2,n) - 1; return 0; }

    userId_undefined

    游梓恒

    倔强青铜
    1阅读
    0回复
    0点赞
首页