| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这个程序怎么错了?#include <iostream>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
int n; int m;
int get_hash_value(char* p)
{
int a = 0;
for(int k = 0; k < m; k++)
{
switch(p[k])
{
case 'A': a = a+2*(20-k); break;
case 'C': a = a+3*(20-k); break;
case 'G': a = a+4*(20-k); break;
case 'T': a = a+5*(20-k); break;
}
//a += (p[k]-'A')*(k+1);
}
return a;
}
int ELFhash(char *key)
{
unsigned long h=0;
while(*key)
{
h=(h<<4)+*key++;
unsigned long g=h&0Xf0000000L;
if(g)
h^=g>>24;
h&=~g;
}
return h%54117;
}
map<string, int> string_count;
int copy_count[20001];
int main(int argc, char* argv[])
{
while(cin >> n >> m)
{
memset(copy_count, 0, sizeof(copy_count));
if(n == 0) break;
for(int i = 0; i < n; i++)
{
char str[20];
scanf("%s", str);
// int value = get_hash_value(str);
map<string, int>::iterator iter;
if((iter = string_count.find(str)) != string_count.end())
{
iter->second++;
}
else
{
string_count.insert(make_pair(str, 1));
}
}
for(map<string, int>::iterator iter = string_count.begin(); iter != string_count.end(); iter++)
{
copy_count[iter->second]++;
}
for(int k = 1; k <= n; k++)
{
printf("%d\n", copy_count[k]);
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator