HNU11376:Golf Bot
Bot
2023-09-11 14:14:10 时间
Problem description |
|
Input |
The first line has one integer: N, the number of different distances the Golf Bot can shoot. Each of the following N lines has one integer, ki, the distance marked in position i of the knob. |
Output |
You should output a single integer, the number of holes Golf Bot will be able to complete. Golf Bot cannot shoot over a hole on purpose and then shoot backwards. |
Sample Input |
3 1 3 5 6 2 4 5 7 8 9 |
Sample Output |
4 |
Problem Source |
HNU Contest |
题意:
打高尔夫。一球能打n种距离。有m个洞,给出每一个洞的位置。问两杆之内,在仅仅能往前打的情况下。能进的有几种洞
思路:
数据非常大?但你要看有30S。明摆着告诉你暴力可行
#include <iostream> #include <stdio.h> #include <string.h> #include <stack> #include <queue> #include <map> #include <set> #include <vector> #include <math.h> #include <bitset> #include <algorithm> #include <climits> using namespace std; #define ls 2*i #define rs 2*i+1 #define UP(i,x,y) for(i=x;i<=y;i++) #define DOWN(i,x,y) for(i=x;i>=y;i--) #define MEM(a,x) memset(a,x,sizeof(a)) #define W(a) while(a) #define gcd(a,b) __gcd(a,b) #define LL long long #define N 200005 #define INF 0x3f3f3f3f #define EXP 1e-8 #define rank rank1 const int mod = 1000000007; int hsh[N*2]; int a[N],b[N]; int main() { int n,m,i,j,k; while(~scanf("%d",&n)) { MEM(hsh,0); for(i = 0; i<n; i++) { scanf("%d",&a[i]); hsh[a[i]] = 1; } sort(a,a+n); for(i = 0; i<n; i++) { for(j = i; j<n; j++) { hsh[a[i]+a[j]] = 1; } } int ans = 0; scanf("%d",&m); for(i = 0; i<m; i++) { scanf("%d",&b[i]); if(hsh[b[i]]) ans++; } printf("%d\n",ans); } return 0; }
相关文章
- [React Testing] Use Generated Data in Tests with tests-data-bot to Improve Test Maintainability
- [React Testing] Use Generated Data in Tests with tests-data-bot to Improve Test Maintainability
- 【Good Bye 2017 B】 New Year and Buggy Bot
- 【第47篇】BoT-SORT:强大的关联多行人跟踪
- 云图说丨“真人?机器?傻傻分不清!” WAF Bot管理,带你慧眼辨“精”!
- 安天透过北美DDoS事件解读IoT设备安全——Mirai的主要感染对象是linux物联网设备,包括:路由器、网络摄像头、DVR设备,入侵主要通过telnet端口进行流行密码档暴力破解,或默认密码登陆,下载DDoS功能的bot,运行控制物联网设备
- IRC BOT原来是利用IRC下发C&C命令——在xx云环境遇到了,恶意软件开的是6666端口
- 行人重识别02-11:fast-reid(BoT)-实用技巧分享(1)-visualize_result,demo
- 行人重识别02-12:fast-reid(BoT)-实用技巧分享(2)-使用osnet轻量级网络,导出caffe模型,项目落地
- 行人重识别02-05:fast-reid(BoT)-pytorch编程规范(fast-reid为例)2-DefaultTrainer解析
- 行人重识别02-00:fast-reid(BoT)-目录-史上最新无死角讲解
- 行人重识别02-13:fast-reid(BoT)-实用技巧分享(3)-精度提升,训练超大数据集randperson
- 行人重识别02-10:fast-reid(BoT)-pytorch编程规范(fast-reid为例)7-模型测试评估-2
- 行人重识别02-09:fast-reid(BoT)-pytorch编程规范(fast-reid为例)6-模型测试评估-1
- 行人重识别02-08:fast-reid(BoT)-pytorch编程规范(fast-reid为例)5-BoT网络模型构建
- 行人重识别02-03:fast-reid(BoT)-白话给你讲论文-翻译无死角
- 行人重识别02-07:fast-reid(BoT)-pytorch编程规范(fast-reid为例)4-迭代器构建,数据加载-2
- 行人重识别02-06:fast-reid(BoT)-pytorch编程规范(fast-reid为例)3-迭代器构建,数据加载-1
- 行人重识别02-04:fast-reid(BoT)-pytorch编程规范(fast-reid为例)1-hooks机制了解
- 行人重识别02-02:fast-reid(BoT)-官方数据训练测试
- 行人重识别02-01:fast-reid(BoT)-资源下载(前奏准备)