-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnia and Minimizing
More file actions
49 lines (46 loc) · 1.25 KB
/
Ania and Minimizing
File metadata and controls
49 lines (46 loc) · 1.25 KB
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
import java.awt.*;
import java.io.*;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.util.Map;
public class problems {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
sc.nextLine();
String s=sc.nextLine();
char[] c=s.toCharArray();
if(s.length()==1){
if(k==0){
System.out.println(s);
return;
}else{
System.out.println(0);
return;
}
}
for(int i=0;i<n;i++){
if(i==0){
if(c[i]!='1' && k>0) {
k--;
c[i] = '1';
}
}
else if(c[i]!='0' && k>0){
k--;
c[i]='0';
}
if(k==0)break;
}
for(int i=0;i<s.length();i++) System.out.print(c[i]);
System.out.println();
}
}