Created
February 11, 2015 16:04
-
-
Save AgrYpn1a/1dc8e1dd9b36eb8a5a76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
string r1, r2; | |
int checkViruses (const int x, const int y, const int l) { | |
short int matches; | |
matches=0; | |
for (int i=-1; i<l-1; i++) { | |
if (r1[x+i] == r2[y+i]) | |
matches++; | |
} | |
return matches; | |
} | |
int main() | |
{ | |
short int n; | |
long int q; | |
cin >> n; | |
cin >> r1 >> r2; | |
cin >> q; | |
for (int i=0; i<q; i++) { | |
short int x, y, l; | |
cin >> x >> y >> l; | |
cout << checkViruses(x, y, l) << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment