【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); } ; }
随机推荐
- PHP数据类型转换(字符转数字,数字转字符)
PHP的数据类型转换属于强制转换,允许转换的PHP数据类型有: (int).(integer):转换成整形 (float).(double).(real):转换成浮点型 (string):转换成字符串 ...
- apache 安装mod_rewrite
如果你的服务器apache还没有安装,那很简单,在编译apache时将mod_rewrite模块编译进去就可以.如果你的apache已经安装好了,现在只想编译出mod_rewrite.so模块,在ap ...
- 一行一行分析JQ源码学习笔记-02
1.防止冲突 设置新变量保存
- Map获取键值,Map的几种遍历方法
Map 类提供了一个称为entrySet()的方法,这个方法返回一个Map.Entry实例化后的对象集.接着,Map.Entry类提供了一个 getKey()方法和一个getValue()方法,Map ...
- 【APP测试初体验】android测试命令----压力测试
**以前一直做web测试,新一份工作新的开始,决定尝试新的测试,于是选择了一个从未接触的 APP测试. 怎么说呢,对于做web测试的人来说,app真的没有一点难度...测试流程一样,测试方法也差不多, ...
- 常用 NHibernate.Criterion
Expression.Where<ScreenView>((v) => v.bizType != 0);
- ubuntu下的ssh工具gstm
(转自:http://www.nenew.net/ubuntu-ssh-gstm.html) 首先安装: sudo apt-get install gstm 就可以安装,当然你也可以到http://s ...
- ECOS 系统查找商品详情图片存入mysql情况。
SELECT g.goods_id, g.bn,g.name,b.brand_name,g.price,g.mktprice,c.cat_name into outfile '/tmp/xxx.xls ...
- tableview 详解I
在开发iphone的应用时基本上都要用到UITableView,这里讲解一下UITableView的使用方法及代理的调用情况 UITableView使用详解 - (void)viewDidLoad { ...
- androidstudio--gsonformat--超爽的数据解析方式
很久以前写json解析用原始的解析json的方法,后来为了加快开发进度,开始使用gson,fastjson等第三方jar包来进行json解析,为了保持apk足够小,不因为引入jar包导致apk文件过大 ...