Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int passengers, stations, outputPassengers, inputPassengers;
- cin >> passengers, stations;
- for (int i = 1; i <= stations; i++) {
- cin >> outputPassengers >> inputPassengers;
- passengers += inputPassengers - outputPassengers;
- if (i % 2 == 1) {
- passengers += 2;
- }
- else {
- passengers -= 2;
- }
- }
- cout << "The final number of passengers is : " << passengers << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement