FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/Code-Forces/src/vus_cossack_strings.java at master · javaarchive/Java · GitHub
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
javaarchive
/
Java
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
3
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
Code-Forces
/
src
/
vus_cossack_strings.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (45 loc) · 1.03 KB
Breadcrumbs
Java
/
Code-Forces
/
src
/
vus_cossack_strings.java
Copy path
File metadata and controls
50 lines (45 loc) · 1.03 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
java
.
util
.*;
public
class
vus_cossack_strings
{
public
static
int
diff
(
String
m
,
String
p
) {
int
answer
=
0
;
assert
(
m
.
length
() ==
p
.
length
());
int
N
=
m
.
length
();
for
(
int
i
=
0
;
i
<
N
;
i
++) {
if
(
m
.
charAt
(
i
) !=
p
.
charAt
(
i
)) {
answer
++;
}
}
return
answer
;
}
public
static
void
main
(
String
[]
args
) {
Scanner
sc
=
new
Scanner
(
System
.
in
);
String
a
=
sc
.
nextLine
();
String
b
=
sc
.
nextLine
();
sc
.
close
();
int
lenA
=
a
.
length
();
int
len
=
b
.
length
();
int
count
=
0
;
//List<String> substrings = new ArrayList<String>();
/*
for(int i = 0 ; i < lenA; i ++) {
if(a.charAt(i) == 1) {
}else {
// assert (a.charAt(i) == 0);
}
}
*/
int
N
=
lenA
-
len
+
1
;
for
(
int
i
=
0
;
i
<
N
;
i
++) {
//if(i + len > lenA) {
// break;
//}
//substrings.add();
System
.
out
.
println
(
i
+
"
\n
"
+(
i
+
len
));
if
(
diff
(
a
.
substring
(
i
,
i
+
len
),
b
) %
2
==
0
) {
count
++;
}
}
//System.out.println(substrings);
System
.
out
.
println
(
count
);
}
}
Back
|
FazBrowse Home
|
New Git URL