Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <algorithm>
  2. #include <cmath>
  3. #include <iostream>
  4. #include <map>
  5. #include <unordered_map>
  6. #include <vector>
  7.  
  8. int main() {
  9.     int linesNum;
  10.     std::unordered_map<std::string, long long> markSum, marksNum;
  11.     std::cin >> linesNum;
  12.     for (int i = 0; i < linesNum; i++) {
  13.         int mark;
  14.         std::string surname;
  15.         std::cin >> surname >> mark;
  16.         markSum[surname] += mark;
  17.         marksNum[surname] += 1;
  18.         std::cout << markSum[surname] / marksNum[surname] << '\n';
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement