思路:

模拟。
实现:

 #include <iostream>
using namespace std;
const int MOD = ;
char a[], b[];
int sum[];
int main()
{
int n, m;
while (cin >> n >> m)
{
for (int i = n - ; i >= ; i--) cin >> a[i];
for (int i = m - ; i >= ; i--)
{
cin >> b[i];
sum[i] = sum[i + ] + b[i] - '';
}
long long ans = , pw = ;
for (int i = ; i < n; i++)
{
if (a[i] == '')
ans = (ans + (sum[i] * pw) % MOD) % MOD;
pw = pw * % MOD;
}
cout << ans << endl;
}
return ;
}

CF1066E Binary Numbers AND Sum的更多相关文章

  1. Codeforces Round #515 (Div. 3) E. Binary Numbers AND Sum

    E. Binary Numbers AND Sum 题目链接:https://codeforces.com/contest/1066/problem/E 题意: 给出两个用二进制表示的数,然后将第二个 ...

  2. Binary Numbers AND Sum CodeForces - 1066E (前缀和)

    You are given two huge binary integer numbers aa and bb of lengths nn and mmrespectively. You will r ...

  3. codefores 1066 E. Binary Numbers AND Sum

    这个题吧 你画一下就知道了 就拿这个例子来讲 4 5100110101 对于b串的话第5位只会经过a串的第4位,b串的第4位会经过a串的第3位和第4位.....b串的第1和第2位会经过a串的每一位 由 ...

  4. E. Binary Numbers AND Sum

    链接 [http://codeforces.com/contest/1066/problem/E] 题意 给你长度分别为n,m的二进制串,当b>0时,对a,b,&运算,然后b右移一位,把 ...

  5. Codeforces Round #515 (Div. 3) E. Binary Numbers AND Sum (二进制,前缀和)

    题意:有两个\(01\)字符串\(a\)和\(b\),每次让\(a\)和\(b\)进行与运算,将值贡献给答案,然后将\(b\)右移一位,直到\(b=0\). 题解:因为\(a\)不变,而\(b\)每次 ...

  6. 【Leetcode_easy】1022. Sum of Root To Leaf Binary Numbers

    problem 1022. Sum of Root To Leaf Binary Numbers 参考 1. Leetcode_easy_1022. Sum of Root To Leaf Binar ...

  7. LeetCode 1022. 从根到叶的二进制数之和(Sum of Root To Leaf Binary Numbers)

    1022. 从根到叶的二进制数之和 1022. Sum of Root To Leaf Binary Numbers 题目描述 Given a binary tree, each node has v ...

  8. HDU-1390 Binary Numbers

    http://acm.hdu.edu.cn/showproblem.php?pid=1390 Binary Numbers Time Limit: 2000/1000 MS (Java/Others) ...

  9. [LeetCode#110, 112, 113]Balanced Binary Tree, Path Sum, Path Sum II

    Problem 1 [Balanced Binary Tree] Given a binary tree, determine if it is height-balanced. For this p ...

随机推荐

  1. JavaScript DOM 编程艺术 ---> JavaScript语法

    二.  JavaScript语法目录 2.1 语法 javaScript代码要通过HTML/XHTML文档才能执行.可以有两种方式完成这一点,第一种是将JavaScript代码放到文档<head ...

  2. .pdm文件怎么打开

    1. 用PowerDesigner打开.pdm文件

  3. Manasa and Combinatorics

    题意: 给定n,求问由2n个字母B,n个字母A构成的字符串中 任意前缀B的个数大于A的个数且任意后缀B的个数大于A的个数的 字符串个数. 解法: 注意到答案不易于直接计算,所以我们考虑应用容斥原理. ...

  4. codevs-2235

    2235 机票打折 题目描述 Description .输入机票原价(3到4位的正整数,单位:元),再输入机票打折率(小数点后最多一位数字).编程计算打折后机票的实际价格(单位:元.计算结果要将个位数 ...

  5. sql之索引

     作用: - 约束 - 加速查找 普通索引:加速查找 create index 索引名称 on 表名(列名,) drop index 索引名称 on 表名 主键索引:加速查找+不能为空+不能重复 cr ...

  6. 5 pyspark学习---Broadcast&Accumulator&sparkConf

    1 对于并行处理,Apache Spark使用共享变量.当驱动程序将任务发送给集群上的执行者时,集群中的每个节点上都有一个共享变量的副本,这样就可以用于执行任务了. 2 两种支持得类型 (1)Broa ...

  7. Android 4.2开发环境搭建

    一.工具 jdk1.7; eclipse 4.3(for java ee); Android SDK; 二.安装JDK并配置 安装略,配置如下: 右击 “我的电脑”->属性->高级系统设置 ...

  8. web调试利器_fiddler

    此文已由作者夏君授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 一.fiddler简介 直接引用官网介绍 The free web debugging proxy for a ...

  9. ZOJ3158 【DFS】

    题意: 从上往下切割,不能切边缘,然后问你两个差值,要小于给出的值. 思路: 直接爆搜,枚举每一行的劈开位置: #include<bits/stdc++.h> using namespac ...

  10. Android开发实践:掌握Camera的预览方向和拍照方向

    http://ticktick.blog.51cto.com/823160/1592267?utm_source=tuicool&utm_medium=referral Android的Cam ...