链接: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. iOS开发 - App程序启动原理

    Info.plist和pch文件的作用 建立一个project后,会在Supporting files目录下看到一个"project名-Info.plist"的文件,该文件对pro ...

  2. 使用DWR实现自己主动补全 相似百度搜索框的自己主动显示效果

    使用DWR实现自己主动补全 自己主动补全:是指用户在文本框中输入前几个字母或汉字的时候,自己主动在存放数据的文件或数据库中将全部以这些字母或汉字开头的数据提示给用户供用户选择 在日常上网过程中,我们常 ...

  3. RecyclerView(替代ListView)使用方法介绍

    在build.gradle文件加入以下代码 compile 'com.android.support:cardview-v7:21.0.3' compile 'com.android.support: ...

  4. WTF

    WTF ,luna黑色主题比较sublime 还是差点!

  5. effctive C++ 读书笔记 条款 16

    条款16 成对使用new和delete时要採取同样形式 #include <iostream> #include <string> using namespace std; / ...

  6. dataTables-details 1.9

    本文共四部分:官网 | 基本使用|遇到的问题|属性表 一:官方网站:[http://www.datatables.net/] 二:基本使用:[http://www.guoxk.com/node/jqu ...

  7. CentOS 6.5 通过 PHP函数的sendmail 发送邮件

    非常多站点须要用到Sendmail函数发送激活邮件,在centos中内置了Sendmail模块,直接调用就可以,假设遇到问题,可採用例如以下两个步骤检測并解决: 1. 命令行输入:echo " ...

  8. Your Firefox profile cannot be loaded. It may be missing or inaccessible

    ubuntu下出现打开frefox出现Your Firefox profile cannot be loaded. It may be missing or inaccessible 1:用命令行输入 ...

  9. oracle:对Index重建、分析

    对index进行分析,index_stats 表很有用.下面例子就结合index相关操作及 index_stats 的使用,对index进行分析. SQL> select count(*) fr ...

  10. Linux 下WAS的java版本查看

    1.查找linux的详细版本号: A.cat /proc/version B.lsb_release -a(可以查出是否为redhat开发的) C.uname -a 2.Linux的java版本 A. ...