?? 2474252_ce.cc
字號:
#include <stdio.h>
#include <map>
#include <malloc.h>
struct species {
char s[81];
} buf;
bool operator==(const species &a, const species &b) {
return !strcmp(a.s, b.s);
}
bool operator<(const species &a, const species &b) {
return strcmp(a.s, b.s) < 0;
}
map<species,int> cnt;
main(){
int tot = 0;
while(gets(buf.s)){
cnt[buf]++;
tot++;
}
for (map<species,int>::iterator i = cnt.begin(); i!=cnt.end(); *i++) {
printf("%s %0.4lf\n",i->first.s, 100.0*i->second/tot);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -