Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit c188689

Browse files
authored
Backup before major change for vus cossack strings
1 parent 6efbb82 commit c188689

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

Code-Forces/bin/cat_party.class

1.68 KB
Binary file not shown.
890 Bytes
Binary file not shown.
2.09 KB
Binary file not shown.

Code-Forces/src/cat_party.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import java.util.*;
2+
public class cat_party {
3+
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
int N = sc.nextInt();
7+
int[] days = new int[N];
8+
for(int i = 0; i < N; i ++) {
9+
days[i] = sc.nextInt();
10+
}
11+
12+
HashMap<Integer,Integer> freq = new HashMap<Integer,Integer>();
13+
int out = N;
14+
for(int i = 0; i < N; i ++) {
15+
freq.putIfAbsent(days[i], 0);
16+
freq.put(days[i],freq.get(days[i])+1);
17+
//System.out.println(freq);
18+
Set<Integer> values = new HashSet<Integer>(freq.values());
19+
//System.out.println("Map "+values.size()+" i = "+i+" "+values);
20+
if(values.size() == 2) {
21+
//System.out.println("Day "+i);
22+
out = i + 1;
23+
}
24+
}
25+
Set<Integer> values = new HashSet<Integer>(freq.values());
26+
//System.out.println("Map "+values.size()+" i = "+N+" "+values);
27+
28+
//System.out.println(freq);
29+
System.out.println(out);
30+
sc.close();
31+
}
32+
33+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import java.util.*;
2+
public class programming_rewards {
3+
public static void main(String[] args) {
4+
Scanner sc = new Scanner(System.in);
5+
int x = sc.nextInt();
6+
int y = sc.nextInt();
7+
int z = sc.nextInt();
8+
if(x > y || x > z) {
9+
System.out.println("No");
10+
}else {
11+
System.out.println("Yes");
12+
}
13+
}
14+
15+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import java.util.*;
2+
3+
public class vus_cossack_strings {
4+
public static int diff(String m, String p) {
5+
int answer = 0;
6+
assert (m.length() == p.length());
7+
int N = m.length();
8+
for(int i = 0; i < N; i ++) {
9+
if(m.charAt(i) != p.charAt(i)) {
10+
answer ++;
11+
}
12+
}
13+
return answer;
14+
}
15+
public static void main(String[] args) {
16+
Scanner sc = new Scanner(System.in);
17+
String a = sc.nextLine();
18+
String b = sc.nextLine();
19+
sc.close();
20+
int lenA = a.length();
21+
int len = b.length();
22+
List<String> substrings = new ArrayList<String>();
23+
/*
24+
for(int i = 0 ; i < lenA; i ++) {
25+
if(a.charAt(i) == 1) {
26+
27+
}else {
28+
// assert (a.charAt(i) == 0);
29+
}
30+
}
31+
*/
32+
for(int i = 0; i < lenA; i++) {
33+
if(i + len > lenA) {
34+
break;
35+
}
36+
substrings.add(a.substring(i, i + len));
37+
}
38+
int count = 0;
39+
//System.out.println(substrings);
40+
for(String s:substrings) {
41+
if(diff(s,b) % 2 == 0) {
42+
count++;
43+
}
44+
}
45+
System.out.println(count);
46+
}
47+
48+
}

0 commit comments

Comments
 (0)