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
Dash-D compiler flag example
pack expansion
Segment Tree Impl
MPL 2-0
Heap: insert and deleteMin() Implementations
Throttle Example using a circular queue (Push all but 2 less than maxSize; then pop all but 2 of current size)
Dynamically allocated array in unique_ptr with custom deleter.
ECE2574_Function_Calling_Example
Erase a std::unordered_map::local_iterator by key
Access to temporary object