Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么会编译错误呀,程序已经在编译器上面完全通过了?C++

Posted by mad_max at 2019-01-27 11:13:22 on Problem 1002
#include <iostream>
using namespace std;
#include <map>

int main()
{
	map<string, int> arr;
	int n;
	cin >> n;
	while (n--)
	{
		string s, temp("");
		cin >> s;
		for (int i = 0; i < s.length(); ++i)
		{
			if (s[i] == '-')continue;
			else if (isdigit(s[i]))
			{
				temp.push_back(s[i]);
			}
			else if (s[i] >= 'A' && s[i] <= 'C')
			{
				temp.push_back('2');
			}
			else if (s[i] >= 'D' && s[i] <= 'F')
			{
				temp.push_back('3');
			}
			else if (s[i] >= 'G' && s[i] <= 'I')
			{
				temp.push_back('4');
			}
			else if (s[i] >= 'J' && s[i] <= 'L')
			{
				temp.push_back('5');
			}
			else if (s[i] >= 'M' && s[i] <= 'O')
			{
				temp.push_back('6');
			}
			else if (s[i] >= 'P' && s[i] <= 'S')
			{
				temp.push_back('7');
			}
			else if (s[i] >= 'T' && s[i] <= 'V')
			{
				temp.push_back('8');
			}
			else if (s[i] >= 'W' && s[i] <= 'Y')
			{
				temp.push_back('9');
			}
		}
		temp.insert(3, "-");
		if(arr.find(temp) != arr.end()){
			++arr[temp];
		}else{
			arr.insert(make_pair(temp, 1));
		}
	}
	for (map<string, int>::iterator m(arr.begin()); m != arr.end(); ++m)
	{
		if (m->second != 1)cout << m->first << ' ' << m->second << endl;
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator