fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <map>
  5. #include <cmath>
  6. using namespace std;
  7.  
  8. string beggest(const vector<int> &num)
  9. {
  10. multimap<size_t, string> mp;
  11.  
  12. for(auto i=0; i<num.size(); ++i){
  13. string str=to_string(num[i]);
  14. cout << str << ' ' << (int)num[i]/(int)pow(10, str.length()-1) << endl;
  15. //size_t n=num[i]%pow(10, str.length()-1);
  16. //cout << n;
  17. //mp[i%pow(10, str.length()-1)]=str;
  18. }
  19.  
  20. //for(auto i:mp)
  21. // cout << i->first << ' ';
  22.  
  23. return string();
  24. }
  25.  
  26. int main() {
  27. vector<int> a({3,30,34,5,9});
  28. string s=beggest(a);
  29.  
  30. //cout << 30%10;
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
3 3
30 3
34 3
5 5
9 9