HDU 1264 Counting Squares (暴力水)
阿新 • • 發佈:2018-12-11
#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; }