离散题目7
来源:互联网 发布:武汉软件新城怎么样 编辑:程序博客网 时间:2024/05/20 03:47
Problem Description
DaYu在新的学习开始学习新的数学知识,一天DaYu学习集合的时候遇到一个问题,他有一个集合A和A的子集B,他想用一个二进制串表示集合B。
Input
多组输入,每组的第一行有两个数n,m,(0< m < n < 10^5).
第二行输入n个数表示集合A,第三行输入m个数表示集合B,|data_i|< 10^5
Output
输出一个01字符串表示集合B
Example Input
10 51 2 3 4 5 6 7 8 9 101 3 5 7 8
Example Output
1010101100
code:
#include <stdio.h>#include <string.h>int main(){ int a[200010], b[200010]; int n, m, i, x; while(~scanf("%d%d", &n, &m)) { memset(b, 0, sizeof(a)); for(i = 0;i<n;i++) { scanf("%d", &a[i]); } for(i = 0;i<m;i++) { scanf("%d", &x); b[x+100000] = 1; } for(i = 0;i<n;i++) { printf("%d", b[a[i]+100000]); } printf("\n"); }}
阅读全文
0 0
- 离散题目7
- 离散题目7
- SDUT-离散题目7
- 离散题目7
- 离散题目7
- 离散题目7
- sdut-离散题目7
- 离散题目7
- 离散题目7-二进制串
- SDUT 3801 离散题目7
- 离散题目7 二进制串表示集合
- 离散题目7(输出转换)
- 离散题目3
- sdut离散题目11
- sdut离散题目13
- sdut离散题目14
- 离散题目12
- 离散题目15
- 开始Python学习
- JQuery上传插件Uploadify的使用
- Vue实例详解与生命周期
- 先来简单介绍一下Block_转发自马在路上大神
- vue移动端地区选择练习1
- 离散题目7
- 论文阅读理解
- Sublime Text查找&替换
- ubuntu samba服务器配置
- Vue.js音乐
- Lua 长度操作符
- centos下elk5.4.0部署
- 离散题目8
- 二叉搜索树之递归