竞赛讨论区 > 1020-只能吃土豆的牛牛 有大佬看一下这个错在哪里了吗?
头像
Utozyz
发布于 2022-05-04 18:42
+ 关注

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;
}

全部评论

(0) 回帖
加载中...
话题 回帖

等你来战

查看全部

热门推荐