Algorithm Problems

[백준] 11970.py - Fence Painting (USACO Bronze)

WakaraNai 2021. 1. 15. 00:26
728x90
반응형

www.acmicpc.net/problem/11970

 

11970번: Fence Painting

Several seasons of hot summers and cold winters have taken their toll on Farmer John's fence, and he decides it is time to repaint it, along with the help of his favorite cow, Bessie. Unfortunately, while Bessie is actually remarkably proficient at paintin

www.acmicpc.net

fs, fl = map(int, input().split())
cs, cl= map(int, input().split())

#if not overlapping
if cs>=fl or cl<=fs:
    print( fl-fs + cl-cs)
else:
    print( max(fl,cl) - min(fs,cs) )

 

728x90
반응형