Advertisement
ledrose

Задача 27: Гонки (по заданию)

Jun 30th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.23 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int i,N,t,a,b,bbest,abest=0;
  6.     cin>>N;
  7.     cin>>t;
  8.     bbest=t;
  9.     for (i=0;i<N;i++) {
  10.         cin>>a>>b;
  11.         bbest=min(bbest+b,abest+a+t);
  12.         abest+=a;
  13.     }
  14.     cout<<bbest;
  15.     return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement