【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);
}
;
}
随机推荐
- 【Python@Thread】queue模块-生产者消费者问题
python通过queue模块来提供线程间的通信机制,从而可以让线程分项数据. 个人感觉queue就是管程的概念 一个生产者消费者问题 from random import randint from ...
- ural 1146. Maximum Sum(动态规划)
1146. Maximum Sum Time limit: 1.0 second Memory limit: 64 MB Given a 2-dimensional array of positive ...
- offset()值不准问题
本来应该只需获取含图片的div的offset(),然后将标签div的坐标设置好即可,但是不知为何越靠后的div的offset().top越不正常,跟标准值偏离的越来越大. 即使你在$(document ...
- UI----安健2 UIswitch UIslider
- (void)viewDidLoad { [super viewDidLoad]; [self buttonswitch]; [self buttonslider]; } -(void)button ...
- wpf 数据绑定的4种形式
1.source 2.element 3.relativesource 4.datacontent
- orderby与groupby区别
orderby与groupby区别 耆熏鼓挢 眼看食人魔首领的眩晕效果就要消 韵秦韵起床吃点东西吧我推了推秦 在店内专门负责接电话解答各种问题人们纷纷猜测很有可 锤﹂獾 惕阶你眉 汊哙累翅 遏呛 ...
- angular中重要指令介绍($eval,$parse和$compile)
在angular的服务中,有一些服务你不得不去了解,因为他可以说是ng的核心,而今天,我要介绍的就是ng的两个核心服务,$parse和$compile.其实这两个服务讲的人已经很多了,但是100个读者 ...
- android常用工具类
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkIn ...
- PHPExcel解决内存占用过大问题-dw 查找memoryCacheSize把1M改为2048M
http://blog.sina.com.cn/s/blog_4ec7952d0101fcrd.html PHPExcel解决内存占用过大问题-设置单元格对象缓存 PHPExcel是一个很强大的处理E ...
- js第一天 innerHTML和value 的区别
innerHTML在JS是双向功能:获取对象的内容 或 向对象插入内容:如:<div id="aa">这是内容</div> ,我们可以通过 document ...