A. Remainder

You are given a huge decimal number consisting of n digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1.

You may perform several (possibly zero) operations with this number. During each operation you are allowed to change any digit of your number; you may change 0 to 1 or 1 to 0. It is possible that after some operation you can obtain a number with leading zeroes, but it does not matter for this problem.

You are also given two integers 0≤y<x<n. Your task is to calculate the minimum number of operations you should perform to obtain the number that has remainder 10y modulo 10x. In other words, the obtained number should have remainder 10y when divided by 10x.

Input

The first line of the input contains three integers n,x,y (0≤y<x<n≤2⋅105) — the length of the number and the integers x and y, respectively.

The second line of the input contains one decimal number consisting of n digits, each digit of this number is either 0 or 1. It is guaranteed that the first digit of the number is 1.

Output

Print one integer — the minimum number of operations you should perform to obtain the number having remainder 10y modulo 10x. In other words, the obtained number should have remainder 10y when divided by 10x.

Examples

input

11 5 2
11010100101

output

1

input

11 5 1
11010100101

output

3

Note

In the first example the number will be 11010100100 after performing one operation. It has remainder 100 modulo 100000.

In the second example the number will be 11010100010 after performing three operations. It has remainder 10 modulo 100000.

思路:

主要看倒数第y位是不是1,以及后x位有几个1。

代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<vector>
#include<set>
#define ll long long
#define mes(x,y) memset(x,y,sizeof(x))
using namespace std;
int main(){
	ll n,x,y,i;string s;
	while(cin>>n>>x>>y>>s){
		ll summ=0,a=n-y-1,c=n-x-1;
		if(s[a]=='0')summ=1;//主要看倒数第y位是不是1
		for(i=n-1;i>c;i--){
			//cout<<i<<":"<<s[i]<<endl;
			if(s[i]=='1'&&i!=a)summ++;
		}//后x位有几个1,倒数第y位不看,已经特判过了
		cout<<summ<<endl;
	}
}
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GUESSERR

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值