离散题目7(输出转换)
来源:互联网 发布:vivo研发待遇知乎 编辑:程序博客网 时间:2024/05/20 05:27
离散题目7
Time Limit: 1000MS Memory Limit: 65536KB
Submit Statistic
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 5
1 2 3 4 5 6 7 8 9 10
1 3 5 7 8
Example Output
1010101100
PS(注意绝对值),思路同第三题
#include <stdio.h>#include <stdlib.h>int main(){int a[300000],b[300000]; int q,i,n,m; while(scanf("%d %d",&n,&m)!=EOF) { for(i=0;i<n;i++) { scanf("%d",&b[i]); a[b[i]+100000]=0; } for(i=0;i<m;i++) { scanf("%d",&q); a[q+100000]=1; } for(i=0;i<n;i++) printf("%d",a[b[i]+100000]); printf("\n"); } return 0;}
阅读全文
0 0
- 离散题目7(输出转换)
- 离散题目7
- 离散题目7
- SDUT-离散题目7
- 离散题目7
- 离散题目7
- 离散题目7
- sdut-离散题目7
- 离散题目7
- 离散题目7-二进制串
- SDUT 3801 离散题目7
- 离散题目7 二进制串表示集合
- 离散题目2(查找重复元素)
- 离散题目四(求交集)
- 离散上级题目5(求全集)
- 离散题目11(判双射函数)
- 离散题目16(自反闭包)
- 离散题目18(传递闭包)
- linux查看系统进程和线程
- tomcat配置
- 解决:android databinding 使用@BindingAdapter 导致application namespace for attribute {} will be ignored
- 应用调试之配置修改内核打印用户态段错误信
- APICloud 渲染机制
- 离散题目7(输出转换)
- Python中输入和输出
- Office for Mac 2016破解版
- SLAM学习资料
- 农夫过河
- 如何制作Android Splash界面
- 关于槽机制和connect函数
- syntax error near unexpected token `then'问题的解决
- iOS 笔试题01~[有答案]