1020-只能吃土豆的牛牛 有大佬看一下这个错在哪里了吗?

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll a[20000]={0};     //开大
    int j=0;
    for(int i=1;i<=10000;j++)   //每次更新幂次
    {
            a[i++]=pow(3,j);
            int temp=i;
            for(int k=1;k<temp-1;k++)
                a[i++]=a[temp-1]+a[k];
    }
    
    int t,cnt=0;
    cin>>t;
    for(cnt=1;cnt<=t;cnt++)    //t组数据
    {
        int ord;
        cin>>ord;    //要查找的数字

        printf("Case #%d: %lld\n",cnt,a[ord]);
    }
    return 0;
}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务