Rectangle 暴力枚举大法

时间:2021-11-05 12:01:02
frog has a piece of paper divided into n rows and m columns. Today, she would like to draw a rectangle whose perimeter is not greater than k.
Rectangle 暴力枚举大法
There are 8 (out of 9) ways when n=m=2,k=6
Find the number of ways of drawing.
枚举长度  然后算出宽度的取值范围  对宽带再进行求合
 #include <cstdio>
#include <cstring>
#include <queue>
#include <cmath>
#include <algorithm>
#include <set>
#include <iostream>
#include <map>
#include <stack>
#include <string>
#include <vector>
#define pi acos(-1.0)
#define eps 1e-6
#define fi first
#define se second
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define bug printf("******\n")
#define mem(a,b) memset(a,b,sizeof(a))
#define fuck(x) cout<<"["<<x<<"]"<<endl
#define f(a) a*a
#define sf(n) scanf("%d", &n)
#define sff(a,b) scanf("%d %d", &a, &b)
#define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define pf printf
#define FRE(i,a,b) for(i = a; i <= b; i++)
#define FREE(i,a,b) for(i = a; i >= b; i--)
#define FRL(i,a,b) for(i = a; i < b; i++)
#define FRLL(i,a,b) for(i = a; i > b; i--)
#define FIN freopen("DATA.txt","r",stdin)
#define lowbit(x) x&-x
#pragma comment (linker,"/STACK:102400000,102400000") using namespace std;
const int maxn = 1e5 + ;
typedef long long LL;
LL n,m,k;
int main() {
while(~sfff(n,m,k)){
k=k/;
LL ans=;
for (int i= ;i<=n ;i++) {
if (k-i<=) break;
LL a=(n-i+);
LL b=min(k-i,m);
LL c=(m+(m-b+))*b/;
ans+=a*c;
}
printf("%lld\n",ans);
}
return ;
}