【A + B + C + D】 问题
A + B + C + D
Time Limit: 40000/20000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 130 Accepted Submission(s): 44
the money I gave you yesterday?""I gave it to a poor old woman," he
answered."You're a good boy," said the mother proudly. "Here are
two cents more. But why are you so interested in the old
woman?""She is the one who sells the candy."A joke, here
entered
Below n four tuple (A, B, C, D), respectively, from the A, B, C, D
selected a, b ,c ,d To calculate the number of combinations of
a+b+c+d = 0;
(1<= n <= 4000)
Then every line containing four integer values (with absolute value
as large as 2^28 )
is zero
-10
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
;
int n;
int s1[maxn*maxn];
int s2[maxn*maxn];
int a[maxn],b[maxn],c[maxn],d[maxn];
int main()
{
// freopen("in.txt", "r", stdin);
while(~scanf("%d", &n))
{;i<n;i++)
scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]);
;i<n;i++)
;j<n;j++)
s1[i*n+j]=a[i]+b[j];
;i<n;i++)
;j<n;j++)
s2[i*n+j] = c[i]+d[j];
sort(s1,s1+n*n);
sort(s2,s2+n*n);
;
;
;i<n*n;i++)
{
&& s1[i]+s2[r]>)
r--;
)break;
int tmp = r;
&& s1[i]+s2[tmp] == )
ans++, tmp--;
}
printf("%d\n", ans);
}
;
}
随机推荐
- webpack - tree shaking
Tree-shaking with webpack 2 and Babel 6 babel-webpack-tree-shaking Ben Levwis
- 自定义MVC框架(二) -基于XML文件
1.oracle的脚本 create table STUDENT ( sid NUMBER primary key, sname ), age NUMBER, pwd ) ) create seque ...
- 一个简单的IM系统(Demo附源码)-- ESFramework 4.0 快速上手(08)
前面的文章已经介绍完了基于ESFramework/ESPlus进行二次开发的所有要点,现在,我们可以开始小试牛刀了. 本文将介绍使用ESFramework的Rapid引擎开发的两个最简单的Demo,E ...
- 一把刀系统维护工具箱 v1.6 绿色版
软件名称: 一把刀系统维护工具箱 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win8 / Win7 / Vista / WinXP 软件大小: 13.7MB 图片预览: 软件简介: 一把 ...
- discuz论坛小记
客服要改sitemap.php要展示最新的回帖内容,但是我不懂discuz,对数据库和php不是特别熟练,PHP后台开发的程序猿太忙了!!~没办法硬着头皮上~ 哎呀数据库对应的是哪个啊?让我看看con ...
- qsort函数辅助函数compare函数的编写
qsort的第四个参数,辅助函数compare的关于不同排序对象的不同写法: 一.对int类型数组排序 ]; int compare(const void *a, const void *b) { r ...
- python 字符转换
我们所看到的“明文字符串”,都是经过编码(比如ASCII.Uncoded.UTF-8.GB-2312等)后呈现在我们面前的. 文本中“3082”想要“所见到所得”到内存中处理,必须decode('he ...
- Codeforces Round 371 Div2 B.Passwords
原题: B. Passwords time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- Get和Post请求的区别
Get:组拼url的方式,提交数据到服务器,url最大长度不能超过4K; Post:直接浏览器把数据写给服务器,流的形式.
- 批量创建IP方法
以下教程,将告诉大家如何在Windows系统中通过命令行,批量添加IP.目标,在本机的的网卡名称为“本地连接”的网卡中,批量添加192.168.1段的ip地址,起开始IP为10,每次增加1,知道22为 ...