반응형
#include<stdio.h>
struct point
{
	int x;
	int y;
};

int main()
{
	point p1, p2;
	int d=0;
	
	scanf("%d %d", &p1.x, &p1.y);
	scanf("%d %d", &p2.x, &p2.y);
	
	d+=(p1.x>p2.x)?(p1.x-p2.x):(p2.x-p1.x);
	d+=(p1.y>p2.y)?(p1.y-p2.y):(p2.y-p1.y);
	
	printf("%d\n", d);
}
/*
1 2
3 5
5

--------------------------------
Process exited after 21.98 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/
반응형

'2019~2020 > 정보 과학' 카테고리의 다른 글

두점의 중점  (0) 2019.08.21
별찍기 개수 만큼 출력  (0) 2019.08.19
성적 입력하기  (0) 2019.06.19
2차원 누적합 만들기  (0) 2019.06.12
문자shift  (2) 2019.05.31

+ Recent posts