CF1165A.Remainder
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
你得到一个由 n 位数字组成的巨大十进制数。保证该数没有前导零。该数的每一位数字均为 0 或 1。
你可以对该数执行若干次(可能为零次)操作。每次操作中,你可以将该数的任意一位数字进行更改:即将 0 改为 1,或将 1 改为 0。某些操作后,你可能得到带有前导零的数,但这对本题无影响。
你还给定两个整数 0≤y<x<n。你的任务是计算为使该数对 10x 取模后余数恰好为 10y 所需执行的最少操作次数。换言之,所得数除以 10x 的余数应为 10y。
输入格式
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.
输入的第一行包含三个整数 n,x,y(0≤y<x<n≤2⋅105),分别表示该数字的长度以及整数 x 和 y。
输入的第二行包含一个由 n 位十进制数字组成的数字,该数字的每一位均为 0 或 1。保证该数字的首位为 1。
输出格式
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.
输出一个整数——为得到模 10x 余 10y 的数所需执行的最少操作次数。换句话说,所得数除以 10x 的余数应为 10y。
输入输出样例
输入#1
11 5 2 11010100101
输出#1
1
输入#2
11 5 1 11010100101
输出#2
3
说明/提示
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.
在第一个例子中,执行一次操作后,该数将变为 11010100100,它对 100000 取模的余数为 100。
在第二个例子中,执行三次操作后,该数将变为 11010100010,它对 100000 取模的余数为 10。
输入解题思路,AI测评打分。不知道怎么写?