Advertisement
Guest User

Untitled

a guest
Apr 6th, 2012
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.88 KB | None | 0 0
  1. #define _CRT_SECURE_NO_DEPRECATE
  2.  
  3. #pragma comment(linker,"/STACK:260108864")
  4.  
  5. #include <iostream>
  6. #include <ctime>
  7. #include <cstdio>
  8. #include <memory>
  9. #include <vector>
  10. #include <set>
  11. #include <map>
  12. #include <queue>
  13. #include <list>
  14. #include <stack>
  15. #include <string>
  16. #include <cstring>
  17. #include <algorithm>
  18. #include <cmath>
  19. #include <ctime>
  20. #include <utility>
  21. #include <iterator>
  22. #include <bitset>
  23. #include <sstream>
  24. #include <numeric>
  25.  
  26. #define pb push_back
  27. #define mp make_pair
  28. #define pii pair<int,int>
  29. #define pdd pair<double,double>
  30. #define LL long long
  31. #define ULL unsigned LL
  32. #define VI vector<int>
  33. #define X first
  34. #define Y second
  35. #define sz(_v) ((int)_v.size())
  36. #define all(_v) (_v).begin(),(_v).end()
  37. #define FOR(i,a,b) for (int i(a); i<=(b); ++i)
  38. #define rep(i,a) FOR(i,1,a)
  39. #define rept(i,a) FOR(i,0,(int)(a)-1)
  40. #define x1 X1
  41. #define y1 Y1
  42. #define sqr(a) ((a)*(a))
  43. #define INF 2000000000
  44. #define PI 3.141592653589
  45. #define eps 0.00000001
  46. #define MOD 1000000007
  47. #define PRIME 1000003
  48.  
  49. using namespace std;
  50.  
  51. int win(char A, char B)
  52. {
  53.     int ret(-1);
  54.     if (A=='R' && B=='S') return ret;
  55.     if (A=='S' && B=='P') return ret;
  56.     if (A=='P' && B=='R') return ret;
  57.     swap(A,B);
  58.     ret=1;
  59.     if (A=='R' && B=='S') return ret;
  60.     if (A=='S' && B=='P') return ret;
  61.     if (A=='P' && B=='R') return ret;
  62.     return 0;
  63. }
  64.  
  65. char s0[1005],s1[1005];
  66.  
  67. int main()
  68. {
  69. #ifndef ONLINE_JUDGE
  70.     {
  71.         freopen("input.txt","r",stdin);
  72.         freopen("output.txt","w",stdout);
  73.     }
  74. #endif
  75.     int n;
  76.     scanf("%d\n",&n);
  77.     gets(s0);
  78.     gets(s1);
  79.     int lenS0(strlen(s0));
  80.     int lenS1(strlen(s1));
  81.     int hm0(0),hm1(0);
  82.     rept(i,n)
  83.     {
  84.         int res=win(s0[i%lenS0],s1[i%lenS1]);
  85.         if (res)
  86.         {
  87.             if (res==1) hm1++;
  88.             else hm0++;
  89.         }
  90.     }
  91.     printf("%d %d\n",hm1,hm0);
  92.     return 0;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement