在本地运行结果没问题,什么也不能说明.
你这代码太过冗杂。看看这个代码
#include
#include
#include
#include
using namespace std;
char map[] = "2223334445556667#77888999#";
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
void visited(char &ch) // visit and format strings
{
if (ch >= 'A' && ch <= 'Z')
ch=map[ch-'A']; // ch equals to its real number
}
int main()
{
int N,i=0,j,flag=0;
string s;
vector
cin>>N;
vector
for (; i
cin>>s;
for (j=0; j
visited(s[j]);
if (s[j]!='-')
{
stored[i] += s[j];
if (stored[i].length()==3)
stored[i] += '-'; // 487 -[3] 3279
}
}
}
sort(stored.begin(),stored.begin()+N); // Quicker than QuickSort!
// should not used stored.end() !
i=0; j=1;
while (i
while(stored[i] == stored[j])
{
counter[i]++;
j++;
flag=1;
}
i=j;
j++;
}
if (flag)
for (i=0; i
if (counter[i]>1)
cout<
else cout<<"No duplicates."<
return 0;
}
希望对你有些帮助。