Advertisement
krasio12356

Bus

Apr 17th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.                                           // Bus
  4. int main()
  5. {
  6.     int pass, stops;
  7.     scanf("%d %d", &pass, &stops);
  8.     int up, down;
  9.     for (int i = 0; i < stops; i++)
  10.     {
  11.         scanf("%d %d", &down, &up);
  12.         pass = pass - down + up;
  13.     }
  14.     pass = pass + stops % 2 * 2;
  15.     printf("The final number of passengers is : %d\n", pass);
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement