链接:https://codeforces.com/contest/1133/problem/D

题意:

给两个数组a,b。

同时ci = ai * d + bi。

找到一个d使c数组中的0最多。

求出最多几个0。

思路:

map记录b/a对应的个数。

同时a和b等于0时。满足任意d使c等于0。

直接额外加上。

代码:

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int MAXN = 2e5 + 10;

int a[MAXN];
int n;
map<long double, int> r; int main()
{
cin >> n;
for (int i = 1;i <= n;i++)
cin >> a[i];
int res = 0;
int other = 0;
long double b;
for (int i = 1;i <= n;i++)
{
cin >> b;
if (a[i] == 0)
{
if (b == 0)
other++;
continue;
}
long double k = b / a[i];
r[k]++;
res = max(res, r[k]);
}
cout << res + other << endl; return 0;
}
//

  

Codeforces Round #544 (Div. 3) D. Zero Quantity Maximization的更多相关文章

  1. Codeforces Round #544 (Div. 3) 题解

    Codeforces Round #544 (Div. 3) D. Zero Quantity Maximization 题目链接:https://codeforces.com/contest/113 ...

  2. Codeforces Round #544 (Div. 3) D F1 F2

    题目链接:D. Zero Quantity Maximization #include <bits/stdc++.h> using namespace std; #define maxn ...

  3. CodeForces Round #544 Div.3

    A. Middle of the Contest 代码: #include <bits/stdc++.h> using namespace std; int h1, m1, h2, m2; ...

  4. Codeforces Round #544 (Div. 3)解题报告

    A.Middle of the Contest 考虑把输入的时间单位化成分钟,相加除以2就好了 #include<bits/stdc++.h> using namespace std; # ...

  5. D. Zero Quantity Maximization ( Codeforces Round #544 (Div. 3) )

    题目链接 参考题解 题意: 给你 整形数组a 和 整形数组b ,要你c[i] = d * a[i] + b[i], 求  在c[i]=0的时候  相同的d的数量 最多能有几个. 思路: 1. 首先打开 ...

  6. Codeforces Round #544 (Div. 3) dp + 双指针

    https://codeforces.com/contest/1133/problem/E 题意 给你n个数(n<=5000),你需要对其挑选并进行分组,总组数不能超过k(k<=5000) ...

  7. Codeforces Round #544 (Div. 3) C. Balanced Team

    链接:https://codeforces.com/contest/1133/problem/C 题意: 给n个数, 在这n个数中选最多n个数,来组成一个队伍. 保证这n个数的最大最小差值不大于5. ...

  8. Codeforces Round #544 (Div. 3) B.Preparation for International Women's Day

    链接:https://codeforces.com/contest/1133/problem/B 题意: 给n个数,和一个k,在n个数中选几对数,保证没对数相加可以整除k. 求最大能选几个数. 思路: ...

  9. Codeforces Round #544 (Div. 3) A.Middle of the Contest

    链接:https://codeforces.com/contest/1133/problem/A 题意: 给两个时间点,求中间时间点. 思路: 数学 代码: #include <bits/std ...

随机推荐

  1. C#WinForm窗体监听/拦截操作动作

    C#中的事件也是通过封装系统消息来实现的,如果你在WndProc函数中不处理该消息 那么,它会被交给系统来处理该消息,系统便会通过代理来实现鼠标单击的处理函数,因此你可以通过 WndProc函数来拦截 ...

  2. sqlldr trailing nullcols

    由于要导入到tmp_content表的一些列(列:要导入的源文件txt or csv文件)为空,也,按理讲我当时另存为(在windows处理)csv,以,分隔.就是这个列没有内容,也该显示, ,之类的 ...

  3. 文件读写&&内容替换

    #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { ...

  4. iOS 如何改变表视图分割线在iOS7中的默认偏移

    - (void)viewDidLoad { [super viewDidLoad]; self.automaticallyAdjustsScrollViewInsets = NO; if ([self ...

  5. JavaScript SHA-1

    1. [文件] webtoolkit.sha1.js ~ 4KB     /****  Secure Hash Algorithm (SHA1)*  http://www.huiyi8.com/css ...

  6. 使用pyinstaller----python转exe

    自己写了一个定时清理日志的脚步,因为服务器是Windows,不想部署Python环境,就考虑到转成exe文件即可. 从网上了解到python转exe方法比较多,我选用了pyinstaller,过程比较 ...

  7. 推箱子 hdu1254

    推箱子 1  http://acm.hdu.edu.cn/showproblem.php?pid=1254 推箱子 2  http://acm.hzau.edu.cn/problem.php?id=1 ...

  8. hdu-5719 Arrange(组合数学)

    题目链接: Arrange Time Limit: 8000/4000 MS (Java/Others)     Memory Limit: 262144/262144 K (Java/Others) ...

  9. 计算机科学 —— 时间戳(timestamp)

    时间戳的一个重要属性即是:唯一性,以起到唯一标识的作用: 1. linux 命令行 $ date +%s 1506222745 2. Python 时间戳 内置 time 库 >> tim ...

  10. jQuery 引用地址(包括jquery和google提供的地址), 节省你不必要的流量

    转载自:http://www.cnblogs.com/henw/archive/2011/09/30/2196255.html 你可以使用这句代码读取jQuery的最新版本的代码文件. jquery官 ...