Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <string>
  4. using namespace std;
  5. /*
  6. int main()
  7. {
  8. priority_queue<int> Q;
  9. queue<int> T;
  10.  
  11. for(string s; cin >> s;)
  12. if(s == "$") break;
  13. else if(s == "#")
  14. {
  15. for(int i =0; !Q.empty() and i <5 ; i++)
  16. {
  17. T.push(Q.top());
  18. Q.pop();
  19. }
  20. }
  21. else
  22. {
  23. Q.push(stoi(s));
  24. }
  25. while(!T.empty())
  26. {
  27. cout << T.front()<<" ";
  28. T.pop();
  29. }
  30. return 0;
  31. }
  32. */
  33. ///////////////////////////////////////////////////////////////
  34. #include <map>
  35. #include <iomanip>
  36. int main(){
  37. int n; cin >> n;
  38. string line;
  39. cin.ignore();
  40. map<int,int> box;
  41. bool flag = true;
  42.  
  43. while(n--){
  44. int mx=0;
  45. getline(cin, line);
  46. for(char& i:line)
  47. {
  48. if ( i == '-') continue;
  49. if ( i >= 'Q') i-=1;
  50. mx *= 10;
  51. if(i >= 'A') mx+= (i-'A')/3+2;
  52. else mx += i-'0';
  53.  
  54. }
  55. flag &= ((box[mx]+=1) == 1);
  56.  
  57. if (flag) cout << "svi razliciti";
  58.  
  59. else
  60. for(auto& i : box){
  61. if(i.second > 1)
  62. cout << setfill('0')<< setw(3)<<(i.first / 10000)
  63. << "-"
  64. << setfill('0')<< setw(4)<<(i.first % 10000)
  65. << ' '<< i.second << "\n";
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement