Submission #105181


Source Code Expand

Copy
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <string>

using namespace std;

int main(void) {
	map<string, vector<pair<double, string>>> map;
	set<string> strs;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int m;
		string large, small;
		cin >> large >> m >> small;
		map[large].push_back(make_pair(m, small));
		strs.insert(large);
	}

	int maxNum = 1;
	string ansMaxStr;
	string ansMinStr;
	for (set<string>::iterator it = strs.begin(); it != strs.end(); it++) {
		for (int i = 0; i < map[(*it)].size(); i++) {
			string maxStr;
			string midStr;
			string minStr;
			midStr = (*it);
			maxStr = (*it);
			int num = 1;
			while (strs.find(midStr) != strs.end() && map[midStr][i].first != 0) {
				cout << midStr << " " << map[midStr][i].second << endl;
				num *= map[midStr][i].first;
				minStr = map[midStr][i].second;
				midStr = map[midStr][i].second;
			}
			if (maxNum < num) {
				maxNum = num;
				ansMaxStr = maxStr;
				ansMinStr = minStr;
			}
		}
	}

	cout << "1" << ansMaxStr << "=" << maxNum << ansMinStr;
	return 0;
}

Submission Info

Submission Time
Task C - 変わった単位
User Sei
Language C++ (G++ 4.6.4)
Score 0
Code Size 1125 Byte
Status

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:40: error: ‘>>’ should be ‘> >’ within a nested template argument list