Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_DEPRECATE
- #pragma comment(linker,"/STACK:260108864")
- #include <iostream>
- #include <ctime>
- #include <cstdio>
- #include <memory>
- #include <vector>
- #include <set>
- #include <map>
- #include <queue>
- #include <list>
- #include <stack>
- #include <string>
- #include <cstring>
- #include <algorithm>
- #include <cmath>
- #include <ctime>
- #include <utility>
- #include <iterator>
- #include <bitset>
- #include <sstream>
- #include <numeric>
- #define pb push_back
- #define mp make_pair
- #define pii pair<int,int>
- #define pdd pair<double,double>
- #define LL long long
- #define ULL unsigned LL
- #define VI vector<int>
- #define X first
- #define Y second
- #define sz(_v) ((int)_v.size())
- #define all(_v) (_v).begin(),(_v).end()
- #define FOR(i,a,b) for (int i(a); i<=(b); ++i)
- #define rep(i,a) FOR(i,1,a)
- #define rept(i,a) FOR(i,0,(int)(a)-1)
- #define x1 X1
- #define y1 Y1
- #define sqr(a) ((a)*(a))
- #define INF 2000000000
- #define PI 3.141592653589
- #define eps 0.00000001
- #define MOD 1000000007
- #define PRIME 1000003
- using namespace std;
- int win(char A, char B)
- {
- int ret(-1);
- if (A=='R' && B=='S') return ret;
- if (A=='S' && B=='P') return ret;
- if (A=='P' && B=='R') return ret;
- swap(A,B);
- ret=1;
- if (A=='R' && B=='S') return ret;
- if (A=='S' && B=='P') return ret;
- if (A=='P' && B=='R') return ret;
- return 0;
- }
- char s0[1005],s1[1005];
- int main()
- {
- #ifndef ONLINE_JUDGE
- {
- freopen("input.txt","r",stdin);
- freopen("output.txt","w",stdout);
- }
- #endif
- int n;
- scanf("%d\n",&n);
- gets(s0);
- gets(s1);
- int lenS0(strlen(s0));
- int lenS1(strlen(s1));
- int hm0(0),hm1(0);
- rept(i,n)
- {
- int res=win(s0[i%lenS0],s1[i%lenS1]);
- if (res)
- {
- if (res==1) hm1++;
- else hm0++;
- }
- }
- printf("%d %d\n",hm1,hm0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement