枚舉a,b,d,然後根據a,b,d的值算出來C。
#include#include #include #include #include #include #define INF 1000000 #define LL __int64 using namespace std; vector vec; int maps[201][201]; LL ans; int n,m,s; int qiu(int a,int b,int d) { int c; int ss; ss=s; int ds; if(d>=b) { if(ss%d==0&&(ss/d)>=a) { return ss/d; } else { ss=ss-a*b; if(d-b&&ss%(d-b)==0) { c=ss/(d-b); if(c<=a)return ss/(d-b); } } } else { ss=ss-a*b+a*d; if(ss%d==0) { return ss/d; } } return 0; } void dos(int a,int b,int c,int d) { int aa; int bb; aa=max(a,c); bb=max(b,d); ans+=(n-aa+1)*(m-bb+1); } void ffdos(int a,int b) { ans+=(n-a+1)*(m-b+1); } void fdos(int a,int b) { ans+=(((a+1)/2)*((b+1)/2))*(n-a+1)*(m-b+1); } int main() { int i,j,k; while(~scanf("%d%d%d",&n,&m,&s)) { ans=0; for(i=1;i<=n;i+=2) { for(j=1;j<=m;j+=2) { if(i*j>s)break; if(i*j==s) { fdos(i,j); continue; } for(k=1;k<=m;k+=2) { int ss; ss=qiu(i,j,k); if(!ss)continue; if(ss>n||ss%2==0)continue; if(ss>=i&&k>=j) { ffdos(ss,k); } else dos(i,j,ss,k); } } } cout<