티스토리 뷰
Pascal/BAEKJOON
pascal 14418번 Three Square (백준), pascal 13733번 Square Deal (백준)
rofn123 2025. 1. 27. 17:09var a,b,c,d,e,f,m,x,y:int64;
begin
x:=0;
readln(a,b);
readln(c,d);
read(e,f);
//0번 : 세개를 나열
if(a=c) and (a=e) and (a=b+d+f) then x:=1;
if(a=c) and (a=f) and (a=b+d+e) then x:=1;
if(a=d) and (a=e) and (a=b+c+f) then x:=1;
if(a=d) and (a=f) and (a=b+c+e) then x:=1;
if(b=c) and (b=e) and (b=a+d+f) then x:=1;
if(b=c) and (b=f) and (b=a+d+e) then x:=1;
if(b=d) and (b=e) and (b=a+c+f) then x:=1;
if(b=d) and (b=f) and (b=a+c+e) then x:=1;
//1번
if(a=d+f) and (c=e) and (a=b+c) then x:=1;
if(a=d+e) and (c=f) and (a=b+c) then x:=1;
if(a=c+e) and (d=f) and (a=b+d) then x:=1;
if(a=c+f) and (d=e) and (a=b+d) then x:=1;
if(b=d+f) and (c=e) and (b=a+c) then x:=1;
if(b=d+e) and (c=f) and (b=a+c) then x:=1;
if(b=c+e) and (d=f) and (b=a+d) then x:=1;
if(b=c+f) and (d=e) and (b=a+d) then x:=1;
if(c=b+f) and (a=e) and (c=d+a) then x:=1;
if(c=b+e) and (a=f) and (c=d+a) then x:=1;
if(c=a+f) and (b=e) and (c=d+b) then x:=1;
if(c=a+e) and (b=f) and (c=d+b) then x:=1;
if(d=b+f) and (a=e) and (d=c+e) then x:=1;
if(d=b+e) and (a=f) and (d=c+f) then x:=1;
if(d=a+f) and (b=e) and (d=c+e) then x:=1;
if(d=a+e) and (b=f) and (d=c+f) then x:=1;
if(e=b+d) and (a=c) and (e=f+a) then x:=1;
if(e=b+c) and (a=d) and (e=f+a) then x:=1;
if(e=a+d) and (b=c) and (e=f+b) then x:=1;
if(e=a+c) and (b=d) and (e=f+b) then x:=1;
if(f=b+d) and (a=c) and (f=e+a) then x:=1;
if(f=b+c) and (a=d) and (f=e+a) then x:=1;
if(f=a+d) and (b=c) and (f=e+b) then x:=1;
if(f=a+c) and (b=d) and (f=e+b) then x:=1;
if x=1 then write('YES') else write('NO');
end.
풀이 : 다중 분기 (많은 조건문)
3개의 직사각형을 하나의 정사각형 (square)로 만들 수 있는지를 판단하기위해 모든 경우의 수를 조건문으로 작성했습니다.

0. 일렬로 세 직사각형을 나열하였을 때
1. 오른쪽 처럼 두었을 때
0번 조건은 먼저 각 직사각형에 길이가 모두 같은 부분이 있는지를 확인하고, 나머지 길이들의 합이, 세 직사각형이 모두 동일한 길이와 길이가 같은지를 판단하면 됩니다.
1번 조건은 아래의 세부조건을 전부 만족하면 됩니다.



https://www.acmicpc.net/problem/14418
https://www.acmicpc.net/problem/13733
두 문제는 동일합니다.
'Pascal > BAEKJOON' 카테고리의 다른 글
pascal 1431번 시리얼 번호 (백준) (0) | 2025.02.19 |
---|---|
pascal 10378번 Grave (백준) (0) | 2025.01.27 |
pascal 3097번 산책 경로 (백준) (0) | 2025.01.26 |
pascal 24775번 The Amazing Human Cannonball (백준) (0) | 2025.01.26 |
pascal 30891번 볶음밥 지키기 (백준) (0) | 2025.01.25 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 최대공약수
- DP
- PASCAL
- 세그먼트 트리
- 1835
- Krustal
- C언어
- 그리디
- 덱
- 최소 스패닝 트리
- Lazy Propagation
- 누적합
- C++
- 플로이드
- 오프라인 쿼리
- java
- find
- DFS
- union
- 브루트포스
- 기하학
- 스택
- 1835번
- XOR
- 정렬
- 그래프
- 백준
- BFS
- 누적 합
- Segment Tree
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함