본문 바로가기
백준 문제 해설

백준 25625 샤틀버스

by toomanysegtrees 2022. 10. 29.

호호호호빵

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

 

25625번: 샤틀버스

3년만에 열리는 대면 SNUPC를 위해서, 민준이는 제2공학관으로 가고자 한다! 제2공학관에 가는 버스는 여러 가지가 있다. 관악02, 5511, 5513, 5516... 어떤 버스를 타더라도 단점이 있는데, 그것은 바로

www.acmicpc.net

풀이

x가 y보다 크면 더한 것을 아니라면 y-x를 출력한다. 

 

시간 복잡도 : $O(1)$

소요 시간 : 1분

아쉬운 점 : 오늘 NYPC 본선이었다. 나도 내년에는 꼭... 본선 가야지..

전체적인 감상 : 화이팅

/* basic setup {{{ */
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define compress(x) sort(all(x)), x.erase(unique(all(x)), x.end())
#define fast_io ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef const int ci;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*}}}*/

int main(){
	fast_io;
	int x, y;
	cin>>x>>y;
	if(x > y) cout<<x+y;
	else cout<<y-x;
	cout<<'\n';
}

'백준 문제 해설' 카테고리의 다른 글

백준 23235 The Fastest Sorting Algorithm In The World  (0) 2022.11.02
백준 17356 욱 제  (0) 2022.11.01
백준 5524 입실 관리  (1) 2022.10.31
백준 20648 Rectangular Pasture  (0) 2022.10.30
백준 25494 단순한 문제 (Small)  (0) 2022.10.28
백준 4470 줄번호  (0) 2022.10.27
백준 8545 Zadanie próbne  (0) 2022.10.26
백준 15592 Blocked Billboard II  (0) 2022.10.25