알고리즘

[알고리즘] 백준 25377 - 빵 (C++)

blueberrysoda 2024. 11. 10. 23:42

[문제 링크] : https://www.acmicpc.net/problem/25377

#include <iostream>
using namespace std;

int T, A, B, Ans = 1234567890;

int main(){
    cin >> T;
    while(T--){
        cin >> A >> B;
        if(A <= B){
            Ans = min(Ans, B);
        }
    }
    if(Ans == 1234567890){
        cout << -1 << "\n";
    }
    else{
        cout << Ans << "\n";
    }
    return 0;
}