Advertisement
Guest User

Untitled

a guest
Feb 11th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <cstring>
  5. using namespace std;
  6. typedef long long ll;
  7. const int N = 1e3 + 5;
  8. const ll INF = 1e15;
  9. string name[N];
  10. ll cost[N], a, b, mn = INF;
  11. int n, ind;
  12. int main()
  13. {
  14.   freopen("shop.in", "r", stdin);
  15.   freopen("shop.out", "w", stdout);
  16.   getline(cin, name[0]);
  17.   cin >> cost[0] >> a >> b >> n;
  18.   a *= cost[0];
  19.   b *= cost[0];
  20.   for (int i = 1; i <= n; i++)
  21.   {
  22.     getline(cin, name[i]);
  23.     getline(cin, name[i]);
  24.     cin >> cost[i];
  25.     if (a <= cost[i] * 100 && cost[i] * 100 <= b && cost[i] < mn)
  26.     {
  27.       mn = cost[i];
  28.       ind = i;
  29.     }
  30.   }
  31.   cout << name[ind];
  32.   return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement