Advertisement
Emiliatan

b512

Apr 6th, 2019
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. /* b512            */
  2. /* AC (5ms, 312KB) */
  3. #include <cstdio>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. typedef pair<int,int> vec;
  9. typedef long long int64;
  10.  
  11. vector<vec> Vect;
  12. int a,b;
  13. int64 ans=0;
  14.  
  15. int main()
  16. {
  17.     while(~scanf("%d:%d", &a, &b) && a && b)
  18.         Vect.emplace_back(make_pair(a, b));
  19.  
  20.     while(~scanf("%d:%d", &a, &b) && a && b)
  21.         for(auto it : Vect)
  22.             if(it.first == a)
  23.             {
  24.                 ans += it.second * b;
  25.                 break;
  26.             }
  27.  
  28.     printf("%lld", ans);
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement