当前位置: 代码迷 >> 综合 >> HDU 1264 Counting Squares (暴力水)
  详细解决方案

HDU 1264 Counting Squares (暴力水)

热度:57   发布时间:2023-11-15 15:24:44.0

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1264

#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define read(x,y) scanf("%d%d",&x,&y)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
const int  maxn =1e6+5;
const int mod=1e9+7;
const int ub=1e6;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
int mp[105][105];///暴力即可,,,别想太多
int main()
{int x1,y1,x2,y2;while(scanf("%d%d%d%d",&x1,&y1,&x2,&y2)!=EOF){if(x1<0){int ans=0;  for(int i=0;i<105;i++) for(int j=0;j<105;j++) ans+=mp[i][j];printf("%d\n",ans);if(x1==-1) memset(mp,0,sizeof(mp));else break;}for(int i=min(y1,y2);i<max(y1,y2);i++)for(int j=min(x1,x2);j<max(x1,x2);j++)mp[i][j]=1;}return 0;
}