全部re求助!

P1464 Function

WoodReal12 @ 2023-07-30 10:51:34

#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#define ll long long
using namespace std;
ll rec[25][25][25];
ll srh(ll a,ll b,ll c){
    if(a<=0||b<=0||c<=0)
        return rec[a][b][c]=1;
    else if(rec[a][b][c]!=0)
        return rec[a][b][c];
    else if(a>20||b>20||c>20)
        return rec[a][b][c]=srh(20,20,20);
    else if(a<b&&b<c)
        return rec[a][b][c]=srh(a,b,c-1)+srh(a,b-1,c-1)-srh(a,b-1,c);
    else
        return rec[a][b][c]=srh(a-1,b,c)+srh(a-1,b-1,c)+srh(a-1,b,c-1)-srh(a-1,b-1,c-1);
}
ll x,y,z;
int main(){
    while(scanf("%lld%lld%lld",&x,&y,&z)&&x!=-1&&y!=-1&&z!=-1){
        memset(rec,0,sizeof(rec));
        printf("w(%lld, %lld, %lld) = %lld\n",x,y,z,srh(x,y,z));
    }
    system("pause");
    return 0;
}

by WoodReal12 @ 2023-07-30 10:52:46

把数组开成105后AC了一个点……


by Superiority @ 2023-07-30 11:58:39

数组再开大点试试


by __zyy_wgcs__ @ 2023-07-30 12:00:44

system("pause");

在linux下运行windows.h的东西……


by FJ_OIer @ 2023-07-30 13:40:02

@chenweizhen 楼上正解


by WoodReal12 @ 2023-07-30 17:23:38

@zyy_1234 @cut_subject_person 删了也不行啊!况且我别的题都是这样写的。


by WoodReal12 @ 2023-07-30 17:24:11

@Storm001 不能再开大了,会报错


by __zyy_wgcs__ @ 2023-07-30 18:16:21

@chenweizhen 其他题竟然能对?我记得就算能用这个东西用过之后有个提示一样的东西啊


by WoodReal12 @ 2023-07-30 18:17:10

@zyy_1234 是啊


by wilson_xiao @ 2023-07-30 20:32:12

@chenweizhen 不能用system,会RE


by WoodReal12 @ 2023-07-31 08:49:19

@wilson_xiao 可是我删了还是不行啊


| 下一页