add1ctus

Школски натпревар

Mar 6th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <cstdio>
  2.  
  3. using namespace std;
  4.  
  5. int days[101];
  6. int result;
  7.  
  8. int main()
  9. {
  10. int n;
  11. scanf("%d",&n);
  12. while(n--)
  13. {
  14. int a,b;
  15. scanf("%d%d",&a,&b);
  16. if(days[a] < b)
  17. {
  18. result -= days[a];
  19. result += b;
  20. days[a] = b;
  21. }
  22. }
  23. printf("%d",result);
  24. return 0;
  25. }
Add Comment
Please, Sign In to add comment