离散题目1
来源:互联网 发布:gta5解封软件 编辑:程序博客网 时间:2024/06/06 04:46
Problem Description
创建一个函数,以确定一个整数值是否包含在集合中。
Input
多组输入。
首先输入集合的元素数n<=100000。
接下来的一行输入n 个整数0<=ai<=n。
接下来的一行输入一个整数 0<=b<=n。
Output
(一组答案占一行),如果存在就输出true,如果不存在就输出false.
Example Input
51 2 3 4 54
Example Output
true
#include <stdio.h>#include <string.h>int main(){ int n,i,a[200000],k,b; while(~scanf("%d",&n)) { memset(a,0,sizeof(a)); for(i=1; i<=n; i++) { scanf("%d",&k); a[k+100000]=1; } scanf("%d",&b); if(a[b+100000]==1) printf("true\n"); else printf("false\n"); } return 0;}
阅读全文
0 0
- 离散题目1
- 离散题目1
- 离散题目1
- 离散题目1
- 离散题目1
- sdut—离散题目1
- 离散题目3
- 离散题目7
- sdut离散题目11
- sdut离散题目13
- sdut离散题目14
- 离散题目12
- 离散题目15
- 3799-->离散题目5
- 3800-->离散题目6
- 离散题目2
- 离散题目3
- 离散题目4
- echarts 双折线图
- Nginx做负载均衡
- 杂记
- 面试总结一
- hadoop调度器
- 离散题目1
- PID控制器原理详解
- jQuery的属性和样式
- SQL Server 获取刚插入数据的ID号
- android选择相册.预览.原图发送.拍照demo源码
- Kotlin入门系列(三) 运算符 char bollean 数组
- Eclipse报错:An internal error has occurred. Widget is disposed
- Java 编程题目 第六题
- vscode 通过 WIN10 ubuntu子系统(Bash On Windows)管理远程主机