1264.cpp
来自「杭电 acm部分代码 有兴趣的可以下载 谢谢」· C++ 代码 · 共 46 行
CPP
46 行
#include<iostream.h>
#include<string>
int sq[110][110];
int main()
{
int a, b, c, d, i, j;
memset(sq, 0, sizeof(sq));
while(cin >> a >> b >> c >> d)
{
if(a == -1 && b == -1 && c == -1 && d == -1)
{
int sum = 0;
for(i = 0; i < 101; i++)
for(j = 0; j < 101; j++)
sum += sq[i][j];
cout << sum << endl;
memset(sq, 0, sizeof(sq));
}
else if(a == -2 && b == -2 && c == -2 && d == -2)
{
int sum = 0;
for(i = 0; i < 101; i++)
for(j = 0; j < 101; j++)
sum += sq[i][j];
cout << sum << endl;
break;
}
else
{
int t;
if(a > c)
{
t = a; a = c; c = t;
}
if(b > d)
{
t = b; b = d; d = t;
}
for(i = a; i < c; i++)
for(j = b; j < d; j++)
sq[i][j] = 1;
}
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?