Processing math: 100%
본문 바로가기

Algorithm/Implementation

(C++) - 백준(BOJ) 21591 : Laptop Sticker

반응형

https://www.acmicpc.net/problem/21591

 

21591번: Laptop Sticker

The single line of input contains four integers wc, hc, ws and hs (1wc,hc,ws,hs1,000), where wc is the width of your new laptop computer, hc is the height of your new laptop computer, ws is the width of the laptop s

www.acmicpc.net

눈치껏 때려맞히는 문제였습니다.

📕 풀이방법

📔 입력 및 초기화

새로산 노트북의 w, h와 스티커의 w, h를 선언 후 입력받습니다.

 

📔 정답출력

노트북의 w, 스티커의 w차이가 2이상이라면 붙일 수 있으므로 1을 출력합니다. 그 외에는 0을 출력합니다.


📕 Code

#include <bits/stdc++.h>
using namespace std;
int w1, h1, w2, h2;
int main() {
    cin >> w1 >> h1 >> w2 >> h2;
    if(w1 - w2 >= 2 && h1 - h2 >= 2) cout << 1;
    else cout << 0;
}