📄 1866.cpp
字号:
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
char str[510];
int hash[1001][1001];
int a,b,c,d;
int main()
{
int i, j, k, t, len, nc, sum, num;
while(gets(str))
{
memset(hash, 0, sizeof(hash));
len = strlen(str);
nc = 0;
sum = 0;
for(i = 0; i < len; i++)
{
num = 0;
if(nc == 4)
nc = 0;
if(isdigit(str[i]))
{
while(isdigit(str[i])){
num = 10 * num + str[i] - 48;
i++;
}
nc++;
if(nc == 1)
a = num;
else if(nc == 2)
b = num;
else if(nc == 3)
c = num;
else if(nc == 4)
{
d = num;
if(a > c){t = a; a = c; c = t;}
if(b > d){t = b; b = d; d = t;}
for(j = a; j < c; j++)
for(k = b; k < d; k++)
hash[j][k] = 1;
a = b = c = d = 0;
}
}
}
for(i = 0; i<=1000; i++)
for(j = 0; j <= 1000; j++)
sum += hash[i][j];
printf("%d\n" ,sum);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -