Advertisement
a53

a_l_o

a53
Aug 15th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. ifstream fin("alo.in");
  4. ofstream fout("alo.out");
  5. int main()
  6. {
  7. int E, Nr, D, N, i;
  8. fin >> E>> N;
  9. for (i=1; i<=N; i++){
  10. fin >> Nr>> D;
  11. if (Nr%10+(Nr/10000*10)==15){
  12. E=E-D*2;
  13. }
  14. if (Nr%10+(Nr/10000*10)==25){
  15. E=E+D;
  16. }
  17. }
  18. fout << E;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement