#include "poszukiwania.h" #include <cstdio> typedef long long ll; int main() { ll a = SignalLength(); ll b = SeqLength(); ll count = 0; for (ll i = 1; i <= b; i++) { if (i + a > b + 1) { continue; } bool match = true; for (ll j = 1; j <= a; j++) { if (SignalAt(j) != SeqAt(i + j - 1)) { match = false; break; } } if (match) { count++; } } printf("%lld\n", count); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include "poszukiwania.h" #include <cstdio> typedef long long ll; int main() { ll a = SignalLength(); ll b = SeqLength(); ll count = 0; for (ll i = 1; i <= b; i++) { if (i + a > b + 1) { continue; } bool match = true; for (ll j = 1; j <= a; j++) { if (SignalAt(j) != SeqAt(i + j - 1)) { match = false; break; } } if (match) { count++; } } printf("%lld\n", count); return 0; } |