A. Remainder Codeforces Round #560 (Div. 3)

You are given a huge decimal number consisting of nn 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<n0≤y<x<n. Your task is to

calculate the minimum number of operations you should perform to

obtain the number that has remainder 10y10y modulo 10x10x. 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⋅1050≤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 10的y次幂 modulo 10的x次幂. In

other words, the obtained number should have remainder 10的y次幂 when

divided by 10的x次幂.

Examples

input

Copy

11 5 2
11010100101
output Copy 1
input Copy 11 5 1
11010100101
output Copy 3

Note

In the first example the number will be 1101010010011010100100 after

performing one operation. It has remainder 100100 modulo 100000100000.

In the second example the number will be 1101010001011010100010 after

performing three operations. It has remainder 1010 modulo

100000100000.

题解如下

#include<iostream>
#include<string.h>
using namespace std;
const int Len = 5e5;
char ar[Len]; int main()
{
//freopen("test.txt","r",stdin);
int n,x,y;
scanf("%d %d %d",&n,&x,&y);
scanf("%s",ar + 1);
int ans = 0;
for(int i = n - x + 1; i <= n; i ++) //在[n-x+1,n] 这个区间内的数字进行一一讨论,如果与当前位 的数字不是自己想要的 ans ++
{
if(i < n - y)
{
if(ar[i] != '0')
ans ++;
}
else if(i == n - y)
{
if(ar[i] != '1')
ans ++;
}
else
{
if(ar[i] != '0')
ans ++;
}
}
printf("%d",ans); return 0;
}

A. Remainder Codeforces Round #560 (Div. 3)的更多相关文章

  1. Codeforces Round #560 (Div. 3) Microtransactions

    Codeforces Round #560 (Div. 3) F2. Microtransactions (hard version) 题意: 现在有一个人他每天早上获得1块钱,现在有\(n\)种商品 ...

  2. Codeforces Round #560 Div. 3

    题目链接:戳我 于是...风浔凌弱菜又去写了一场div.3 总的来说,真的是比较简单.......就是.......不开long long见祖宗 贴上题解-- A 给定一个数,为01串,每次可以翻转一 ...

  3. Codeforces Round #560 (Div. 3)A-E

    A. Remainder output standard output You are given a huge decimal number consisting of nn digits. It ...

  4. Codeforces Round #277 (Div. 2) 题解

    Codeforces Round #277 (Div. 2) A. Calculating Function time limit per test 1 second memory limit per ...

  5. Codeforces Round #422 (Div. 2)

    Codeforces Round #422 (Div. 2) Table of Contents Codeforces Round #422 (Div. 2)Problem A. I'm bored ...

  6. Codeforces Round #272 (Div. 2) 题解

    Codeforces Round #272 (Div. 2) A. Dreamoon and Stairs time limit per test 1 second memory limit per ...

  7. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  8. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  9. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

随机推荐

  1. 今夜我懂了Lambda表达式_解析

    现在时间午夜十一点~ 此刻的我血脉喷张,异常兴奋:因为专注得学习了一把java,在深入集合的过程中发现好多套路配合Lambda表达式真的是搜椅子,so开了个分支,决定从"只认得", ...

  2. 【5min+】AspNet Core中的全局异常处理

    系列介绍 [五分钟的dotnet]是一个利用您的碎片化时间来学习和丰富.net知识的博文系列.它所包含了.net体系中可能会涉及到的方方面面,比如C#的小细节,AspnetCore,微服务中的.net ...

  3. linux命令行界面如何安装图形化界面

    linux命令行界面如何安装图形化界面 目录 问题描述 解决方案 安装包 测试是否安装成功 如何卸载图形化界面 遭遇问题 问题描述 当我们在安装Linux系统时,我们一开始可能安装的是非图形界面的系统 ...

  4. MySQL的万字总结(缓存,索引,Explain,事务,redo日志等)

    hello,小伙伴们,好久不见,MySQL系列停更了差不多两个月了,也有小伙伴问我为啥不更了呢?其实我去看了MySQL的全集,准备憋个大招,更新篇长文(我不会告诉你是因为我懒的). 好了,话不多说,直 ...

  5. 备份Oracl数据库.bat

    =========================== @echo off echo ================================================ echo Win ...

  6. FSBPM流程引擎(002)之表单+自定义流程挂载到引擎

    本章节介绍如何将实际业务的表单和自定义流程挂载到FSBPM流程引擎上. 首先进入引擎交互界面: 点击创建:->出差申请 然后根据实际的业务输入对应的数据项即可,比如[姓名,部门,开始时间,结束时 ...

  7. python3.7安装pygame

    经过各种找,下面这个安装地址中的版本是最全的 下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame 本机python版本

  8. Windows通过VNC连接并显示Linux桌面(Ubuntu16.04)

    目录 Linux中安装VNC服务 Linux中安装桌面环境 Windows中安装VNC Viewer Linux中安装VNC服务 sudo apt-get update sudo apt-get in ...

  9. java-方法。(新手)

    import java.util.ArrayList; //导入包.import java.util.Iterator;import java.util.LinkedList;import java. ...

  10. 聊一聊 React 中的 CSS 样式方案

    和 Angular,Vue 不同,React 并没有如何在 React 中书写样式的官方方案,依靠的是社区众多的方案.社区中提供的方案有很多,例如 CSS Modules,styled-compone ...