XidianOJ 1195 Industry of Orz Pandas

--正文
贪心
排序好慢慢找就好
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL; int a[],b[];
int n,m,x;
int main(){
while (scanf("%d %d %d",&n,&m,&x) != EOF){
int i,j,k;
for (i=;i<=n;i++){
scanf("%d",&a[i]);
}
for (i=;i<=m;i++){
scanf("%d",&b[i]);
}
sort(a+,a++n); sort(b+,b++m);
int nowa = ,nowb = ,total = ;
while (nowa <= n && nowb <= m){
int res = a[nowa] - b[nowb];
if (res<) res = -res;
if (res<=x){
nowa ++; nowb ++; total ++; continue;
}
else {
if (a[nowa] > b[nowb]){
nowb++;
}
else {
nowa++;
}
}
}
printf("%d\n",total);
}
return ;
}
XidianOJ 1195 Industry of Orz Pandas的更多相关文章
- XidianOJ 1120 Gold of Orz Pandas
题目描述 Orz Panda is addicted to one RPG game. To make his character stronger, he have to fulfil tasks ...
- Another Array of Orz Pandas
Another Array of Orz Pandas 题目链接:http://acm.xidian.edu.cn/problem.php?id=1187 线段树 线段树维护区间和以及区间内各个数平方 ...
- Cai Xukun and Orz Pandas Gym - 102309C
题目链接:https://vjudge.net/problem/Gym-102309C 题意:给定蔡徐坤投篮的位置和篮筐的位置以及最大初速度,求一个初速度和时间. 思路:一开始我以为要用到二分,后面仔 ...
- 【Codeforces】Orz Panda Cup
大大出的题 大大经常吐槽没有人补,所以我决定做一个 A. APA of Orz Pandas 题意:给你一个包含+-*/%和()的表达式,让你把它转化成java里BigInteger的形式 大概就像这 ...
- xdoj-1117(记忆化搜索+组合数学)
因为我是从上到下,所以就不叫动态规划而叫记忆化搜索吧 (不过运行时间只有3ms....应该是很不错的吧) 排版怎么那么难看...编辑的时候不是这样子的啊?! 思想 : 大眼一看应该是一道很裸的状压dp ...
- pandas应用之分组因子暴露和分位数分析
pandas应用之分组因子暴露和分位数分析 首先感谢原书作者Mes McKinney和batteryhp网友的博文, 俺在此基础上继续探索python的神奇功能. 用A股的实际数据, 以书里的代码为蓝 ...
- 利用 pandas 进行数据的预处理——离散数据哑编码、连续数据标准化
数据的标准化 数据标准化就是将不同取值范围的数据,在保留各自数据相对大小顺序不变的情况下,整体映射到一个固定的区间中.根据具体的实现方法不同,有的时候会映射到 [ 0 ,1 ],有时映射到 0 附近的 ...
- 五、Pandas玩转数据
Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s ...
- pandas - groupby 深入及数据清洗案例
import pandas as pd import numpy as np 分割-apply-聚合 大数据的MapReduce The most general-purpose GroupBy me ...
随机推荐
- EAN
public static string EAN13(string s) { ;//输入的校验码 if (!Regex.IsMatch(s, @"^\d{12}$")) { if ...
- LeetCode "Design Twitter"
A mix of hashmap, list and heap. struct Tw { Tw(long long pts, int tid) { ts = pts; tweetid = tid; } ...
- Tomcat服务器重启失败:The server may already be running in another process, or a system process may be using the port.
在控制台重启Tomcat服务器,报错如下: 原因分析: You've another instance of Tomcat already running. You can confirm this ...
- SQL分页查询
假如tb_customer表中的数据量非常大,在显示时要分页显示而且每页只显示10条信息.为了效果我们取第三页的数据. 方法一:遍历两次表,取不同的数据. select top 10 * from t ...
- Linux:加载硬盘
在腾讯云购买了一个云服务器,送了20G的系统盘,购买了一个50G的数据盘. 第一次进入系统后,通过镜像中自带的脚本,挂载数据盘. 后来重装了系统,进入系统后查看硬盘信息.
- U3V第三方软件驱动路径
NI驱动位置:C:\Program Files (x86)\National Instruments\NI-IMAQdx\Staging\NI USB3 VisionA&B驱动位置:D:\Pr ...
- 线程优先级抢占实验【RT-Thread学习笔记 3】
同时处于就绪状态的线程,优先级高的先执行. 高优先级就绪时,低优先级任务让出CPU,让高优先级任务先执行. 创建两个任务函数: //线程优先级抢占 void thread1_entry(void *p ...
- 【学】React的学习之旅2 - React Component的生命周期
分成三个状态: Mounted Update Unmounted Mounted:当我们看到组件在浏览器中从无到有的效果的时候,mounted已经结束了,这个组件已经被mounted了 有这个阶段有2 ...
- java 事件监听 - 键盘
java 事件监听 - 键盘 //事件监听 //键盘事件监听,写了一个小案例,按上下左右,改变圆形的位置,圆形可以移动 import java.awt.*; import javax.swing.*; ...
- innodb的锁
观察innodb的锁时间,需要关注: mysqladmin extended-status -r -i 1 -uroot | grep "Innodb_row_lock_time" ...