-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1881_A.cpp
More file actions
50 lines (42 loc) · 807 Bytes
/
1881_A.cpp
File metadata and controls
50 lines (42 loc) · 807 Bytes
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
39
40
41
42
43
44
45
46
47
48
49
50
#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
while(n>0){
string x;
string s;
int l1,l2;
cin>>l1>>l2;
cin>>x>>s;
int ans=0;;
int times=10;
bool flag = true;
while(times>0){
size_t idx = x.find(s);
if(idx != string::npos){
cout << ans<<"\n";
flag=false;
break;
}
x+=x;
ans++;
times--;
}
if(flag){
cout << -1<<"\n";
}
n--;
}
return 0;
}
int powerx(int n, int x){
if(x==0){
return 1;
}
if(x>0){
return n*powerx(n,x-1);
}else{
return (1/n)*powerx(n,x+1);
}
}