Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
10226
//g++ 5.4.0 #include <iostream> #include <map> using namespace std; int main(){ map<string, int> arb_m; string arb_n, memoria; int casos, cuenta; double porcentaje; cin>>casos; getline(cin, memoria); getline(cin, memoria); while(casos--){ cuenta=0; arb_m.clear(); while(getline(cin, arb_n) and arb_n!=""){ //cout<<"arbol: "<<arb_n<<": "<<(int)arb_n[0]<<"\n"; arb_m[arb_n]++; cuenta++; } //cout<<"cuenta: "<<cuenta; for(auto &a: arb_m){ porcentaje=100/(double)cuenta; cout<<a.first<<" "; printf("%.4lf\n",porcentaje*(double)a.second); } if(casos>1)cout<<"\n"; } }
run
|
edit
|
history
|
help
0
Assignment Operator Example
Compute Power Manually
Non type template argument
Tree Example
Test size_t
MiniumNumberDivideConquer
Exploring stringstreams
return reference (clang)
C++ standard
Fun with Pointers #2