1
2
3
4
5
6
|
类型名称 字节数 取值范围
signed
char
1 -128~+127
short
int
2 -32768~+32767
int
4 -2147483648~+2147483647
long
int
4 -2147483648~+2141483647
long
long
int
8 -9223372036854775808~+9223372036854775807
|
longlong int input use% lld, also with output% lld, with llabs absolute value ();
long int input% ld, the output also with% ld, with the absolute value Labs ();
int take the absolute value ABS ();
flloat absolute value by FABS ();
64-bit compiler:
int: 4 bytes
long: 8 bytes
long long: 8 bytes
unsigned long: 8 bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
unsigned
int
(unsigned
long
)
4字节8位可表达位数:2^32=42 9496 7296
范围:0 ~ 42 9496 7295 (42*10^8)
int
(
long
)
4字节8位可表达位数:2^32=42 9496 7296
范围:-21 4748 3648 ~ 21 4748 3647 (21*10^8)
long
long
(
__int64
)
8字节8位可表达位数:2^64=1844 6744 0737 0960 0000
范围:-922 3372 0368 5477 5808 ~ 922 3372 0368 5477 5807 (922*10^16)
unsigned
long
(unsigned
__int64
)
8字节8位可表达位数:2^64=1844 6744 0737 0960 0000
范围:0 ~ 1844 6744 0737 0955 1615 (1844*10^16)
|
Title: Title PS matrix area is simple to understand, but not long long int types of inputs as well as the absolute value of a long time = = ~ fiddle
Title Description
Entry
No more than 100 rectangles.
Export
Sample input
1 2 3 4
1 0 2 3
2 1 3 1
2 8 7 1
Sample Output
0
3
4
35
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
long long int x0,x1,y0,y1,temp;
long long int i,j;
long long int a[10000];
long long int num=0;
while(scanf("%lld%lld%lld%lld",&x0,&y0,&x1,&y1)!=EOF)
{
a[num++]=llabs((x1-x0)*(y1-y0));
// printf("%d\n",a[num-1]);
}
for(i=0;i<num-1;i++)
{
for(j=0;j<num-i-1;j++)
{
if(a[j]>a[j+1])
{
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
}
}
}
for(i=0;i<num;i++)
{
printf("%lld\n",a[i]);
}
}