Advertisement
ibragimova_mariam

Untitled

Nov 16th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <set>
  3. #include <map>
  4. #include <string>
  5.  
  6. #define para pair <int,int>
  7.  
  8. using namespace std;
  9.  
  10. int main ()
  11. {
  12. string str;
  13. cin >> str;
  14. int n = str.length();
  15. cout << n;
  16.  
  17. int x1 = 0, y1 = 0, x2 = 0, y2 = 0;
  18. for(int i = 0; i < n; i ++) {
  19. switch (str[i]) {
  20. case 'W' : x2--;
  21. break;
  22. case 'E' : x2++;
  23. break;
  24. case 'N' : y2++;
  25. break;
  26. case 'S' : y2--;
  27. break;
  28. set <para> myset;
  29.  
  30. para para1 = make_pair(x1, y1);
  31. para para2 = make_pair(x2, y2);
  32.  
  33. myset.insert(para2);
  34. mymap[para1] = myset;
  35. }
  36. /*map<para, set<para>> mymap;
  37.  
  38. for (int i = 1; i < 2; i ++) {
  39. set <para> myset;
  40. myset.insert(make_pair(i, i));
  41. mymap[make_pair(0, 0)] = myset;
  42. }
  43.  
  44. if(mymap.find(make_pair(0, 0)) != mymap.end()) {
  45. if(mymap[make_pair(0, 0)].find(make_pair(2, 2)) != mymap[make_pair(0, 0)].end()) cout << "is in set" << endl;
  46. else {
  47. cout << "not int set";
  48. mymap[make_pair(0, 0)].insert(make_pair(2, 2));
  49. if(mymap[make_pair(0, 0)].find(make_pair(2, 2)) != mymap[make_pair(0, 0)].end()) cout << "NOW is in set";
  50. }
  51. }
  52. else cout << "not in map";*/
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement