Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define endl '\n'
- #define sz(x) int(x.size())
- #define all(x) x.begin(), x.end()
- int main() {
- ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
- int n, p;
- int No = 0;
- while (scanf("%d %d%*c", &n, &p), n || p) {
- if (No) printf("\n");
- while (n--) {
- scanf("%*[^\n]%*c");
- }
- char tmp[100];
- double price;
- int mets;
- char ans[100];
- int Max_mets = 0;
- double Min_price = 1e9;
- for (int i = 0; i < p; i++) {
- scanf("%[^\n]\n%lf%d%*c", tmp, &price, &mets);
- if (mets > Max_mets || (mets == Max_mets && price < Min_price)) {
- strcpy(ans, tmp);
- Max_mets = mets;
- Min_price = price;
- }
- while (mets--) scanf("%*[^\n]%*c");
- }
- printf("RFP #%d\n%s\n", ++No, ans);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement