TOJ 4110 A+B

It's a simple hash problem.

You hash the number.and you get the answer.

The portal:http://acm.tju.edu.cn/toj/showp4110.html

#include 
#include 
#include 
#include 

long long f[1005];

void Deal_with(){
    int T,n,q;
    scanf("%d",&T);
    while(T--){
        memset(f,0,sizeof(f));
        scanf("%d",&n);
        for(int i=0;i 1000)
                        continue;
                if(i == tempa - i)ans += f[i] * (f[i] - 1);
                else ans += f[i] * f[tempa - i];
            }
            printf("%lld\n",ans);
        }

    }
}

int main(void){
    //freopen("a.in","r",stdin);
    Deal_with();
    return 0;
}


你可能感兴趣的:(TOJ,Simple,problem,acm,hash,it)